*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-namespace {
-
+namespace
+{
static bool gCallBackCalled;
static void TestCallback(PropertyNotification& source)
gCallBackCalled = true;
}
-const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS)
-const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check.
-
+const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS)
+const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check.
class TestClass : public ConnectionTracker
{
public:
-
- TestClass(Integration::Scene scene )
- : mScene( scene )
+ TestClass(Integration::Scene scene)
+ : mScene(scene)
{
}
void Initialize()
{
mActor = Actor::New();
- mScene.Add( mActor );
- mNotification = mActor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
- mNotification.NotifySignal().Connect( this, &TestClass::OnPropertyNotify );
+ mScene.Add(mActor);
+ mNotification = mActor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ mNotification.NotifySignal().Connect(this, &TestClass::OnPropertyNotify);
}
void RemovePropertyNotification()
{
- mActor.RemovePropertyNotification( mNotification );
+ mActor.RemovePropertyNotification(mNotification);
}
void RemovePropertyNotifications()
void Terminate()
{
- mScene.Remove( mActor );
+ mScene.Remove(mActor);
mActor.Reset();
mNotification.Reset();
}
- void OnPropertyNotify( PropertyNotification& source )
+ void OnPropertyNotify(PropertyNotification& source)
{
tet_infoline(" OnPropertyNotify");
gCallBackCalled = true;
}
- Actor mActor;
+ Actor mActor;
PropertyNotification mNotification;
- Integration::Scene mScene;
+ Integration::Scene mScene;
};
-
/*
* Simulate time passed by.
*
{
int time = 0;
- for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ for(int i = 0; i <= (duration / RENDER_FRAME_INTERVAL); i++)
{
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
} // unnamed namespace
-
// Positive test case for a method
int UtcDaliPropertyNotificationDownCast(void)
{
TestApplication application;
tet_infoline(" UtcDaliPropertyNotificationDownCast");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- BaseHandle handle = notification;
+ BaseHandle handle = notification;
PropertyNotification notificationHandle;
DALI_TEST_CHECK(notification);
DALI_TEST_CHECK(handle);
DALI_TEST_CHECK(!notificationHandle);
- notificationHandle = PropertyNotification::DownCast( handle );
+ notificationHandle = PropertyNotification::DownCast(handle);
DALI_TEST_CHECK(notificationHandle);
END_TEST;
}
-
// Negative test case for a method
int UtcDaliPropertyNotificationDownCastNegative(void)
{
Actor actor = Actor::New();
actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- BaseHandle handle = somethingElse;
+ BaseHandle handle = somethingElse;
PropertyNotification notificationHandle;
- notificationHandle = PropertyNotification::DownCast( handle );
+ notificationHandle = PropertyNotification::DownCast(handle);
DALI_TEST_CHECK(!notificationHandle);
END_TEST;
}
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- DALI_TEST_CHECK( notification );
- DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(notification);
+ DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- PropertyNotification movedNotification = std::move( notification );
- DALI_TEST_CHECK( movedNotification );
+ PropertyNotification movedNotification = std::move(notification);
+ DALI_TEST_CHECK(movedNotification);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !notification );
+ DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!notification);
PropertyCondition condition = movedNotification.GetCondition();
- DALI_TEST_CHECK( condition );
- DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(condition);
+ DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION);
- PropertyCondition movedCondition = std::move( condition );
- DALI_TEST_CHECK( movedCondition );
+ PropertyCondition movedCondition = std::move(condition);
+ DALI_TEST_CHECK(movedCondition);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !condition );
+ DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!condition);
END_TEST;
}
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- DALI_TEST_CHECK( notification );
- DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(notification);
+ DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
PropertyNotification movedNotification;
- movedNotification = std::move( notification );
- DALI_TEST_CHECK( movedNotification );
+ movedNotification = std::move(notification);
+ DALI_TEST_CHECK(movedNotification);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !notification );
+ DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!notification);
PropertyCondition condition = movedNotification.GetCondition();
- DALI_TEST_CHECK( condition );
- DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(condition);
+ DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION);
PropertyCondition movedCondition;
- movedCondition = std::move( condition );
- DALI_TEST_CHECK( movedCondition );
+ movedCondition = std::move(condition);
+ DALI_TEST_CHECK(movedCondition);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !condition );
+ DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!condition);
END_TEST;
}
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 );
+ 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;
}
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition true, should receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition false, should not receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Deleting notification and it's owning object, should not receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
object->Terminate();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing notification and it's owning object, should not receive a notification");
object->Initialize();
object->RemovePropertyNotification();
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing all notifications and it's owning object, should not receive a notification");
object->Initialize();
object->RemovePropertyNotifications();
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
-
+ DALI_TEST_CHECK(!gCallBackCalled);
delete object;
END_TEST;
// Currently, Type registry properties cannot be animated
try
{
- actor.AddPropertyNotification( PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition( 100.0f ) );
+ actor.AddPropertyNotification(PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition(100.0f));
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "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;
}
// Currently, Type registry properties cannot be animated
try
{
- actor.AddPropertyNotification( PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition( 100.0f ) );
+ actor.AddPropertyNotification(PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition(100.0f));
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "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;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ));
- DALI_TEST_CHECK( notification );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
+ DALI_TEST_CHECK(notification);
END_TEST;
}
Actor actor = Actor::New();
- PropertyCondition condition = GreaterThanCondition(100.0f);
+ PropertyCondition condition = GreaterThanCondition(100.0f);
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
- DALI_TEST_CHECK( condition == notification.GetCondition() );
+ DALI_TEST_CHECK(condition == notification.GetCondition());
END_TEST;
}
class PropertyNotificationConstWrapper
{
public:
-
PropertyNotificationConstWrapper(PropertyNotification propertyNotification)
- :mPropertyNotification(propertyNotification)
+ : mPropertyNotification(propertyNotification)
{
-
}
/**
Actor actor = Actor::New();
- PropertyCondition condition = GreaterThanCondition(100.0f);
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
+ PropertyCondition condition = GreaterThanCondition(100.0f);
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
PropertyNotificationConstWrapper notificationConst(notification);
- const PropertyCondition& conditionReference1 = notificationConst.GetCondition();
- const PropertyCondition& conditionReference2 = notificationConst.GetCondition();
+ const PropertyCondition& conditionReference1 = notificationConst.GetCondition();
+ const PropertyCondition& conditionReference2 = notificationConst.GetCondition();
- DALI_TEST_CHECK( (&conditionReference1) == (&conditionReference2) );
- DALI_TEST_CHECK( conditionReference1 == condition );
+ DALI_TEST_CHECK((&conditionReference1) == (&conditionReference2));
+ DALI_TEST_CHECK(conditionReference1 == condition);
END_TEST;
}
TestApplication application;
tet_infoline(" UtcDaliPropertyNotificationGetTarget");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Actor actor2 = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- Actor targetActor = Actor::DownCast( notification.GetTarget() );
+ Actor targetActor = Actor::DownCast(notification.GetTarget());
- DALI_TEST_CHECK( targetActor == actor );
+ DALI_TEST_CHECK(targetActor == actor);
END_TEST;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- Property::Index targetProperty = notification.GetTargetProperty();
+ Property::Index targetProperty = notification.GetTargetProperty();
- DALI_TEST_EQUALS( targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION);
END_TEST;
}
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
PropertyNotification::NotifyMode notifyMode = notification.GetNotifyMode();
- DALI_TEST_EQUALS( notifyMode, PropertyNotification::NotifyOnChanged, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION);
END_TEST;
}
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
- notification.NotifySignal().Connect( &TestCallback );
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
bool notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, false, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move right to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move left to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move right to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(100.0f ) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, LessThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move left to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move right to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move left to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move inside to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move outside (right) to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move inside to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move outside (left) to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move inside to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move outside (right) to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, GreaterThanCondition(0.5f) );
- notification.NotifySignal().Connect( &TestCallback );
-
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, GreaterThanCondition(0.5f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move right to satisfy XAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move down to satisfy YAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move forward to satisfy ZAxis
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Change alpha Colour to satisfy w/alpha component condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, LessThanCondition(0.5f) );
- notification.NotifySignal().Connect( &TestCallback );
-
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, LessThanCondition(0.5f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move left to satisfy XAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move up to satisfy YAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move back to satisfy ZAxis
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Change alpha Colour to satisfy w/alpha component condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f));
+ notification.NotifySignal().Connect(&TestCallback);
// set outside all conditions
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move x to inside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move y to inside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move z to inside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// change alpha to inside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f));
+ notification.NotifySignal().Connect(&TestCallback);
// set inside all conditions
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move x to outside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move y to outside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move z to outside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// change alpha to outside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
int UtcDaliPropertyNotificationSetSizeResultP(void)
{
TestApplication application;
- bool notifyResult;
+ 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);
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
- notification.NotifySignal().Connect( &TestCallback );
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION);
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline(" UtcDaliPropertyConditionGetArguments");
- PropertyCondition condition = GreaterThanCondition( 50.0f );
+ PropertyCondition condition = GreaterThanCondition(50.0f);
- DALI_TEST_EQUALS( condition.GetArgumentCount(), 1u, TEST_LOCATION );
- float value = condition.GetArgument( 0 );
- DALI_TEST_EQUALS( value, 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 );
+ condition = InsideCondition(125.0f, 250.0f);
- 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 );
+ 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;
}
-int UtcDaliPropertyNotificationStep(void)
+int UtcDaliPropertyNotificationStepVector4(void)
{
TestApplication application;
- tet_infoline(" UtcDaliPropertyNotificationStep");
+ tet_infoline(" UtcDaliPropertyNotificationStepVector4");
Actor actor = Actor::New();
application.GetScene().Add(actor);
- const float step = 100.0f;
+ const float step = 10.0f;
+ float initValue = 5.0f;
+
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::COLOR, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ // test both directions
+ for(int i = 1; i < 10;)
+ {
+ // Move x to positive
+ gCallBackCalled = false;
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+
+ initValue = -5.0f;
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ for(int i = 1; i < 10;)
+ {
+ // Move x to negative
+ gCallBackCalled = false;
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+ END_TEST;
+}
+
+int UtcDaliPropertyNotificationStepFloat(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliPropertyNotificationStepFloat");
+
+ Actor actor = Actor::New();
+ application.GetScene().Add(actor);
+
+ const float step = 10.0f;
+ float initValue = 5.0f;
+
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, StepCondition(step, 50.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
// set initial position
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// test both directions
- for( int i = 1 ; i < 10 ; ++i )
+ for(int i = 1; i < 10;)
{
- // Move x to negative position
+ // Move x to positive
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3((i * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
}
- for( int i = 1 ; i < 10 ; ++i )
+ initValue = -5.0f;
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ for(int i = 1; i < 10;)
+ {
+ // Move x to negative
+ gCallBackCalled = false;
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+ END_TEST;
+}
+
+int UtcDaliPropertyNotificationStepVector2(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliPropertyNotificationStepVector2");
+
+ Actor actor = Actor::New();
+ application.GetScene().Add(actor);
+
+ const float step = 10.0f;
+ float initValue = 5.0f;
+
+ Property::Index propertyIndex = actor.RegisterProperty("testProperty", Vector2::ZERO);
+
+ PropertyNotification notification = actor.AddPropertyNotification(propertyIndex, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ // test both directions
+ for(int i = 1; i < 10;)
+ {
+ // Move x to positive
+ gCallBackCalled = false;
+ actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+
+ initValue = -5.0f;
+ actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ for(int i = 1; i < 10;)
+ {
+ // Move x to negative
+ gCallBackCalled = false;
+ actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+ END_TEST;
+}
+
+int UtcDaliPropertyNotificationStepVector3(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliPropertyNotificationStepVector3");
+
+ Actor actor = Actor::New();
+ application.GetScene().Add(actor);
+
+ const float step = 10.0f;
+ float initValue = 5.0f;
+
+ // float
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ // set initial position
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ // test both directions
+ for(int i = 1; i < 10;)
+ {
+ // Move x to positive position
+ gCallBackCalled = false;
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
+ }
+
+ initValue = -5.0f;
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+
+ for(int i = 1; i < 10;)
{
// Move x to negative position
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(-(i * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
+ Wait(application, DEFAULT_WAIT_PERIOD);
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
const float averageStep = 100.0f;
- for( int i = 1 ; i < 10 ; i++ )
+ 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 );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, VariableStepCondition(values));
+ notification.NotifySignal().Connect(&TestCallback);
// set initial position lower than first position in list
- actor.SetProperty( Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i )
+ 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.SetProperty( Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
static bool gCallBack2Called = false;
-void TestCallback2(PropertyNotification& source)
+void TestCallback2(PropertyNotification& source)
{
gCallBack2Called = true;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
// this should complete in first frame
- PropertyNotification notification1 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(90.0f) );
- notification1.NotifySignal().Connect( &TestCallback );
+ 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 );
+ 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
// 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;
+ 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 );
+ 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 );
+ DALI_TEST_EQUALS(gCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, true, TEST_LOCATION);
- gCallBackCalled = false;
+ 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 );
+ DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION);
END_TEST;
}
+
+int UtcDaliPropertyConditionGetArgumentNegative(void)
+{
+ TestApplication application;
+ Dali::PropertyCondition instance;
+ instance.Reset();
+ try
+ {
+ unsigned long arg1(0u);
+ instance.GetArgument(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliPropertyConditionGetArgumentCountNegative(void)
+{
+ TestApplication application;
+ Dali::PropertyCondition instance;
+ instance.Reset();
+ try
+ {
+ instance.GetArgumentCount();
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}