本文整理汇总了C++中BaseHandle::DoAction方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseHandle::DoAction方法的具体用法?C++ BaseHandle::DoAction怎么用?C++ BaseHandle::DoAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseHandle
的用法示例。
在下文中一共展示了BaseHandle::DoAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliBaseHandleDoAction
int UtcDaliBaseHandleDoAction(void)
{
TestApplication application;
tet_infoline("Positive Test Dali::BaseHandle::UtcDaliBaseHandleDoAction");
Actor actor = Actor::New();
BaseHandle actorObject = actor;
DALI_TEST_CHECK(actorObject);
// Check that an invalid command is not performed
Property::Map attributes;
DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false);
// Check that the actor is visible
actor.SetVisible(true);
DALI_TEST_CHECK(actor.IsVisible() == true);
// Check the actor performed an action to hide itself
DALI_TEST_CHECK(actorObject.DoAction("hide", attributes) == true);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check that the actor is now invisible
DALI_TEST_CHECK(actor.IsVisible() == false);
// Check the actor performed an action to show itself
DALI_TEST_CHECK(actorObject.DoAction("show", attributes) == true);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check that the actor is now visible
DALI_TEST_CHECK(actor.IsVisible() == true);
Stage::GetCurrent().Add(actor);
// Build an animation with initial duration of 1 second
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
BaseHandle animationObject = animation;
DALI_TEST_CHECK(animationObject);
// Check the current animation duration is 1 second
DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Set the new duration to be 2 seconds
float newDurationSeconds(2.0f);
Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds );
attributes["duration"] = newDurationSecondsValue;
// Check the animation performed an action to play itself with the specified duration of 2 seconds
animationObject.DoAction("play", attributes);
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(static_cast<unsigned int>(newDurationSeconds * 1000.0f) + 1u/*just beyond the animation duration*/);
// We expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
// Check the new animation duration is 2 seconds
DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION);
END_TEST;
}