本文整理汇总了C++中SignalData::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalData::Reset方法的具体用法?C++ SignalData::Reset怎么用?C++ SignalData::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalData
的用法示例。
在下文中一共展示了SignalData::Reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliHoverActorBecomesInsensitive
int UtcDaliHoverActorBecomesInsensitive(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// Change actor to insensitive
actor.SetSensitive( false );
// Emit a motion signal, signalled with an interrupted
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例2: UtcDaliHoverInterrupted
int UtcDaliHoverInterrupted(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// Emit another interrupted signal, our signal handler should not be called.
application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
END_TEST;
}
示例3: UtcDaliTapGestureSignalReceptionAttachDetachMany
int UtcDaliTapGestureSignalReceptionAttachDetachMany(void)
{
TestApplication application;
Actor first = Actor::New();
first.SetSize(100.0f, 100.0f);
first.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(first);
Actor second = Actor::New();
second.SetSize(100.0f, 100.0f);
second.SetX(100.0f);
second.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(second);
// Render and notify
application.SendNotification();
application.Render();
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(first);
detector.Attach(second);
detector.DetectedSignal().Connect(&application, functor);
// Tap within second actor's area
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(120.0f, 10.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(120.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
// Tap within first actor's area
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 10.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
// Detach the second actor
detector.Detach(second);
// second actor shouldn't receive event
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(120.0f, 10.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(120.0f, 10.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// first actor should continue receiving event
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 10.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
示例4: UtcDaliTapGestureSignalReceptionRotatedActor
int UtcDaliTapGestureSignalReceptionRotatedActor(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetOrientation(Dali::Degree(90.0f), Vector3::ZAXIS);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
// Do tap, only check finished value
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(5.0f, 5.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(5.0f, 5.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetOrientation(Dali::Degree(180.0f), Vector3::ZAXIS);
application.SendNotification();
application.Render();
// Do tap, should still receive event
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(5.0f, 5.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(5.0f, 5.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetOrientation(Dali::Degree(90.0f), Vector3::YAXIS);
application.SendNotification();
application.Render();
// Do tap, inside the actor's area (area if it is not rotated), Should not receive the event
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(70.0f, 70.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(70.0f, 70.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
示例5: UtcDaliHoverLeave
int UtcDaliHoverLeave(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Set actor to require leave events
actor.SetLeaveRequired( true );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Leave, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// Another motion outside of actor, no signalling
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Another motion event inside actor, signalled with motion
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Motion, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
// We do not want to listen to leave events anymore
actor.SetLeaveRequired( false );
// Another motion event outside of actor, no signalling
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例6: UtcDaliHoverActorBecomesInsensitiveParentConsumer
int UtcDaliHoverActorBecomesInsensitiveParentConsumer(void)
{
TestApplication application;
Actor rootActor( Stage::GetCurrent().GetRootLayer() );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data, false );
actor.HoveredSignal().Connect( &application, functor );
// Connect to root actor's hovered signal
SignalData rootData;
HoverEventFunctor rootFunctor( rootData ); // Consumes signal
rootActor.HoveredSignal().Connect( &application, rootFunctor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
data.Reset();
rootData.Reset();
// Remove actor from Stage
Stage::GetCurrent().Remove( actor );
// Render and notify
application.SendNotification();
application.Render();
// Make root actor insensitive
rootActor.SetSensitive( false );
// Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.hoverEvent.points[0].state, TEST_LOCATION );
END_TEST;
}
示例7: UtcDaliHoverMultipleRenderTasksWithChildLayer
int UtcDaliHoverMultipleRenderTasksWithChildLayer(void)
{
TestApplication application;
Stage stage ( Stage::GetCurrent() );
Vector2 stageSize ( stage.GetSize() );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
Layer layer = Layer::New();
layer.SetSize(100.0f, 100.0f);
layer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
actor.Add(layer);
// Create render task
Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f );
RenderTask renderTask ( Stage::GetCurrent().GetRenderTaskList().CreateTask() );
renderTask.SetViewport( viewport );
renderTask.SetInputEnabled( true );
renderTask.SetSourceActor( actor );
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
layer.HoveredSignal().Connect( &application, functor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Ensure renderTask actor can be hit too.
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Disable input on renderTask, should not be hittable
renderTask.SetInputEnabled( false );
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例8: UtcDaliTapGestureSignalReceptionDetach
int UtcDaliTapGestureSignalReceptionDetach(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
// Start tap within the actor's area
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
// repeat the tap within the actor's area - we should still receive the signal
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
// Detach actor
detector.DetachAll();
// Ensure we are no longer signalled
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
示例9: UtcDaliTapGestureLayerConsumesTouch
int UtcDaliTapGestureLayerConsumesTouch(void)
{
TestApplication application;
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(actor);
// Add a detector
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect( &application, functor );
// Add a layer to overlap the actor
Layer layer = Layer::New();
layer.SetSize(100.0f, 100.0f);
layer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add( layer );
layer.RaiseToTop();
// Render and notify
application.SendNotification();
application.Render();
Vector2 screenCoords( 50.0f, 50.0f );
// Emit signals, should receive
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
layer.SetTouchConsumed( true );
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
示例10: UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent
static void UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent()
{
ToolkitTestApplication application;
tet_infoline("UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent");
SignalData data;
SignalUnhandledKeyEventCallback callback( data );
KeyInputFocusManager manager = KeyInputFocusManager::Get();
manager.UnhandledKeyEventSignal().Connect( &callback, &SignalUnhandledKeyEventCallback::Callback );
Integration::KeyEvent event("a", "a", 0, 0, 0, Integration::KeyEvent::Up);
application.ProcessEvent(event);
DALI_TEST_CHECK(data.functorCalled);
DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK(event.keyCode == data.receivedKeyEvent.keyCode);
DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.keyPressed );
DALI_TEST_CHECK(event.state == data.receivedKeyEvent.state );
data.Reset();
Integration::KeyEvent event2("v", "v", 0, 0, 0, Integration::KeyEvent::Up);
application.ProcessEvent(event2);
DALI_TEST_CHECK(data.functorCalled);
DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK(event2.keyCode == data.receivedKeyEvent.keyCode);
DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.keyPressed );
}
示例11: UtcDaliHoverLeaveActorReadded
int UtcDaliHoverLeaveActorReadded(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
// Set actor to receive hover-events
actor.SetLeaveRequired( true );
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit a started and motion
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2( 11.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Remove actor from stage and add again
stage.Remove( actor );
stage.Add( actor );
// Emit a motion within the actor's bounds
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2( 12.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a motion outside the actor's bounds
application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( TouchPoint::Leave, data.hoverEvent.points[0].state, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例12: UtcDaliTapGestureTouchBehindGesturedSystemOverlay
int UtcDaliTapGestureTouchBehindGesturedSystemOverlay(void)
{
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
systemOverlay.GetOverlayRenderTasks().CreateTask();
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
systemOverlayActor.SetSize(100.0f, 100.0f);
systemOverlayActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
systemOverlay.Add(systemOverlayActor);
// Stage actor
Actor stageActor = Actor::New();
stageActor.SetSize(100.0f, 100.0f);
stageActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(stageActor);
// Render and notify
application.SendNotification();
application.Render();
// Set stage actor to touchable
TouchEventData touchData;
TouchEventDataFunctor touchFunctor( touchData );
stageActor.TouchedSignal().Connect(&application, touchFunctor);
// Set system-overlay actor to have the gesture
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(systemOverlayActor);
detector.DetectedSignal().Connect(&application, functor);
Vector2 screenCoords( 50.0f, 50.0f );
// Do a tap inside both actors' area
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( false, touchData.functorCalled, TEST_LOCATION );
data.Reset();
touchData.Reset();
// Do touch in the same area
application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
END_TEST;
}
示例13: UtcDaliTapGestureSignalReceptionChildHit
int UtcDaliTapGestureSignalReceptionChildHit(void)
{
TestApplication application;
Actor parent = Actor::New();
parent.SetSize(100.0f, 100.0f);
parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
Stage::GetCurrent().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
child.SetSize(100.0f, 100.0f);
child.SetAnchorPoint(AnchorPoint::CENTER);
child.SetParentOrigin(ParentOrigin::CENTER);
child.SetOrientation(Dali::Degree(90.0f), Vector3::ZAXIS);
parent.Add(child);
TouchEventFunctor touchFunctor;
child.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(parent);
detector.DetectedSignal().Connect(&application, functor);
// Do tap - hits child area but parent should still receive it
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
// Attach child and generate same touch points
// (Also proves that you can detach and then re-attach another actor)
detector.Attach(child);
detector.Detach(parent);
// Do an entire tap, only check finished value
data.Reset();
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(51.0f, 51.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(51.0f, 51.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
END_TEST;
}
示例14: UtcDaliHoverStencilNonRenderableActor
int UtcDaliHoverStencilNonRenderableActor(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
Actor stencil = Actor::New();
stencil.SetSize(50.0f, 50.0f);
stencil.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stencil.SetDrawMode( DrawMode::STENCIL );
stage.Add(stencil);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit an event within stencil area
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit an event outside the stencil area but within the actor area, we should have a hit!
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 60.0f, 60.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例15: UtcDaliHoverOffscreenRenderTasks
int UtcDaliHoverOffscreenRenderTasks(void)
{
TestApplication application;
Stage stage ( Stage::GetCurrent() );
Vector2 stageSize ( stage.GetSize() );
// FrameBufferImage for offscreen RenderTask
FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) );
// Create a renderable actor to display the FrameBufferImage
Actor renderableActor = CreateRenderableActor( frameBufferImage );
renderableActor.SetParentOrigin(ParentOrigin::CENTER);
renderableActor.SetSize( stageSize.x, stageSize.y );
renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
stage.Add( renderableActor );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add( actor );
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects
stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
// Create a RenderTask
RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
renderTask.SetSourceActor( actor );
renderTask.SetTargetFrameBuffer( frameBufferImage );
renderTask.SetInputEnabled( true );
// Create another RenderTask
RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() );
renderTask2.SetInputEnabled( true );
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}