#include <iostream>
#include <stdlib.h>
-#include <boost/bind.hpp>
-#include <dali/dali.h>
+#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
{
mActor = Actor::New();
Stage::GetCurrent().Add( mActor );
- mNotification = mActor.AddPropertyNotification( Actor::POSITION_X, GreaterThanCondition(100.0f) );
+ mNotification = mActor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
mNotification.NotifySignal().Connect( this, &TestClass::OnPropertyNotify );
}
tet_infoline(" UtcDaliPropertyNotificationDownCast");
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X, GreaterThanCondition(100.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
BaseHandle handle = notification;
PropertyNotification notificationHandle;
Actor somethingElse = Actor::New();
Actor actor = Actor::New();
- actor.AddPropertyNotification(Actor::POSITION_X, GreaterThanCondition(100.0f));
+ actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
BaseHandle handle = somethingElse;
PropertyNotification notificationHandle;
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X, GreaterThanCondition(100.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
DALI_TEST_CHECK( notification );
END_TEST;
}
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "false && \"Property notification added to non animatable property", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "false && \"Property notification added to event side only property", TEST_LOCATION );
}
END_TEST;
}
Actor actor = Actor::New();
PropertyCondition condition = GreaterThanCondition(100.0f);
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X, condition);
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
DALI_TEST_CHECK( condition == notification.GetCondition() );
END_TEST;
}
Actor actor = Actor::New();
PropertyCondition condition = GreaterThanCondition(100.0f);
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X, condition);
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
PropertyNotificationConstWrapper notificationConst(notification);
const PropertyCondition& conditionReference1 = notificationConst.GetCondition();
const PropertyCondition& conditionReference2 = notificationConst.GetCondition();
Actor actor = Actor::New();
Actor actor2 = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X,
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
Actor targetActor = Actor::DownCast( notification.GetTarget() );
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X,
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
Property::Index targetProperty = notification.GetTargetProperty();
- DALI_TEST_EQUALS( targetProperty, Actor::POSITION_X, TEST_LOCATION );
+ DALI_TEST_EQUALS( targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION );
END_TEST;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::POSITION_X,
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
PropertyNotification::NotifyMode notifyMode = notification.GetNotifyMode();
END_TEST;
}
+int UtcDaliPropertyNotificationGetNotifyResultP(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliPropertyNotificationGetNotifyMode");
+
+ Actor actor = Actor::New();
+
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
+ GreaterThanCondition(100.0f));
+ notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ gCallBackCalled = false;
+ notification.NotifySignal().Connect( &TestCallback );
+
+ actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
+
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ bool notifyResult = notification.GetNotifyResult();
+
+ DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliPropertyNotificationGreaterThan(void)
{
TestApplication application;
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION_X, GreaterThanCondition(100.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION_X, LessThanCondition(100.0f ) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(100.0f ) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(200.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION_X, InsideCondition(100.0f, 200.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION_X, OutsideCondition(100.0f, 200.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(150.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, GreaterThanCondition(100.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, GreaterThanCondition(100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 1, GreaterThanCondition(100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, GreaterThanCondition(100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 2, GreaterThanCondition(100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, GreaterThanCondition(100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::COLOR, 3, GreaterThanCondition(0.5f) );
+ notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, GreaterThanCondition(0.5f) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, LessThanCondition(-100.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, LessThanCondition(-100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 1, LessThanCondition(-100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, LessThanCondition(-100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 2, LessThanCondition(-100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, LessThanCondition(-100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::COLOR, 3, LessThanCondition(0.5f) );
+ notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, LessThanCondition(0.5f) );
notification.NotifySignal().Connect( &TestCallback );
actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, InsideCondition(-100.0f, 100.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 1, InsideCondition(-100.0f, 100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 2, InsideCondition(-100.0f, 100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::COLOR, 3, InsideCondition(0.25f, 0.75f) );
+ notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f) );
notification.NotifySignal().Connect( &TestCallback );
// set outside all conditions
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, OutsideCondition(-100.0f, 100.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 1, OutsideCondition(-100.0f, 100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::POSITION, 2, OutsideCondition(-100.0f, 100.0f) );
+ notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f) );
notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::COLOR, 3, OutsideCondition(0.25f, 0.75f) );
+ notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f) );
notification.NotifySignal().Connect( &TestCallback );
// set inside all conditions
tet_infoline(" UtcDaliPropertyConditionGetArguments");
PropertyCondition condition = GreaterThanCondition( 50.0f );
- PropertyCondition::ArgumentContainer arguments = condition.GetArguments();
- DALI_TEST_EQUALS( arguments.size(), 1u, TEST_LOCATION );
- Property::Value value = arguments[0];
- DALI_TEST_EQUALS( value.Get<float>(), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( condition.GetArgumentCount(), 1u, TEST_LOCATION );
+ float value = condition.GetArgument( 0 );
+ DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION );
condition = InsideCondition( 125.0f, 250.0f );
- arguments = condition.GetArguments();
-
- DALI_TEST_EQUALS( arguments.size(), 2u, TEST_LOCATION );
- Property::Value value1 = arguments[0];
- Property::Value value2 = arguments[1];
- DALI_TEST_EQUALS( value1.Get<float>(), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( value2.Get<float>(), 250.0f, TEST_LOCATION );
- END_TEST;
-}
-
-namespace
-{
-
-class PropertyConditionConstWrapper
-{
-public:
-
- PropertyConditionConstWrapper(PropertyCondition propertyCondition)
- :mPropertyCondition(propertyCondition)
- {
-
- }
- /**
- * Returns const reference to property arguments.
- * @return const reference.
- */
- const PropertyCondition::ArgumentContainer& GetArguments() const
- {
- return mPropertyCondition.GetArguments();
- }
-
- PropertyCondition mPropertyCondition;
-};
-} // anon namespace
-
-int UtcDaliPropertyConditionGetArgumentsConst(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliPropertyConditionGetArgumentsConst");
-
- PropertyCondition condition = GreaterThanCondition( 50.0f );
- PropertyConditionConstWrapper conditionConst(condition);
- const PropertyCondition::ArgumentContainer& argumentsRef1 = conditionConst.GetArguments();
- const PropertyCondition::ArgumentContainer& argumentsRef2 = conditionConst.GetArguments();
-
- DALI_TEST_CHECK( (&argumentsRef1) == (&argumentsRef2) );
- DALI_TEST_EQUALS( argumentsRef1.size(), 1u, TEST_LOCATION );
- Property::Value value = argumentsRef1[0];
- DALI_TEST_EQUALS( value.Get<float>(), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( condition.GetArgumentCount(), 2u, TEST_LOCATION );
+ float value1 = condition.GetArgument( 0 );
+ float value2 = condition.GetArgument( 1 );
+ DALI_TEST_EQUALS( value1, 125.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value2, 250.0f, TEST_LOCATION );
END_TEST;
}
const float step = 100.0f;
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, StepCondition(step, 50.0f) );
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, StepCondition(step, 50.0f) );
notification.NotifySignal().Connect( &TestCallback );
// set initial position
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
- std::vector<float> values;
+ Dali::Vector<float> values;
const float averageStep = 100.0f;
for( int i = 1 ; i < 10 ; i++ )
{
- values.push_back(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
+ values.PushBack(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
}
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, VariableStepCondition(values) );
+ 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.size() - 1 ; ++i )
+ for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i )
{
gCallBackCalled = false;
// set position half way between the current values
}
END_TEST;
}
+
+static bool gCallBack2Called = false;
+void TestCallback2(PropertyNotification& source)
+{
+ gCallBack2Called = true;
+}
+
+int UtcDaliPropertyNotificationOrder(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ // this should complete in first frame
+ PropertyNotification notification1 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(90.0f) );
+ notification1.NotifySignal().Connect( &TestCallback );
+ // this should complete in second frame
+ PropertyNotification notification2 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(150.0f) );
+ notification2.NotifySignal().Connect( &TestCallback2 );
+ Animation animation = Animation::New( 0.032f ); // finishes in 32 ms
+ animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
+ animation.Play();
+
+ // flush the queue
+ application.SendNotification();
+ // first frame
+ application.Render(RENDER_FRAME_INTERVAL);
+ // no notifications yet
+ DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
+ gCallBackCalled = false;
+ gCallBack2Called = false;
+
+ // dont serve the notifications but run another update & render
+ // this simulates situation where there is a notification in event side but it's not been picked up by event thread
+ // second frame
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
+
+ // serve the notifications
+ application.SendNotification();
+ DALI_TEST_EQUALS( gCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gCallBack2Called, true, TEST_LOCATION );
+
+ gCallBackCalled = false;
+ gCallBack2Called = false;
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+ DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
+
+ END_TEST;
+}