From: joogab.yun Date: Thu, 13 Mar 2025 04:33:53 +0000 (+0900) Subject: When hoverevent of geometry type is used, DispatchHoverMotion is not handled properly... X-Git-Tag: accepted/tizen/unified/20250320.015506~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F321008%2F3;p=platform%2Fcore%2Fuifw%2Fdali-core.git When hoverevent of geometry type is used, DispatchHoverMotion is not handled properly when false. This is fixed. Change-Id: Ibcd68776f55a6779485a36d2d17b030801225b7f --- diff --git a/automated-tests/src/dali/utc-Dali-GeoHoverProcessing.cpp b/automated-tests/src/dali/utc-Dali-GeoHoverProcessing.cpp index 556ec78ae..ab6c715f1 100644 --- a/automated-tests/src/dali/utc-Dali-GeoHoverProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-GeoHoverProcessing.cpp @@ -665,6 +665,87 @@ int UtcDaliGeoHoverLeaveParentConsumer(void) END_TEST; } + +int UtcDaliGeoHoverLeaveWithDispatchMotion(void) +{ + TestApplication application; + application.GetScene().SetGeometryHittestEnabled(true); + Actor rootActor(application.GetScene().GetRootLayer()); + + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().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); + + // Set actor to require leave events + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + rootActor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + + // Sets the dispatch hover motion property to false. This means that hover motion events are not recived + actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, false); + rootActor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, false); + + // Emit a started signal + application.ProcessEvent(GenerateSingleHover(PointState::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(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); + data.Reset(); + rootData.Reset(); + + // Emit a motion signal outside of actor, should be signalled with a Leave + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + // The event is not received because DISPATCH_HOVER_MOTION is false. + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + data.Reset(); + rootData.Reset(); + + // Another motion outside of actor, only rootActor signalled + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(201.0f, 201.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); + data.Reset(); + rootData.Reset(); + + // Another motion event inside actor, signalled with start. This is because a new hover event was started on that actor. + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(50.0f, 50.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + data.Reset(); + rootData.Reset(); + + // Another motion event inside actor, Since DispatchHoverMotion is false, no signal is received. + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); + data.Reset(); + rootData.Reset(); + + END_TEST; +} + int UtcDaliGeoHoverActorBecomesInsensitive(void) { TestApplication application; diff --git a/dali/internal/event/events/hover-event-processor.cpp b/dali/internal/event/events/hover-event-processor.cpp index ca2925a90..f3d89bb02 100644 --- a/dali/internal/event/events/hover-event-processor.cpp +++ b/dali/internal/event/events/hover-event-processor.cpp @@ -141,7 +141,7 @@ Dali::Actor EmitGeoHoverSignals(std::list& actorLists, c { Actor* actorImpl(*rIter); // Only emit the signal if the actor's hover signal has connections (or derived actor implementation requires hover). - if(ShouldEmitHoverEvent(*actorImpl, hoverEvent)) + if(actorImpl->GetHoverRequired()) { DALI_TRACE_SCOPE(gTraceFilter, "DALI_EMIT_HOVER_EVENT_SIGNAL"); PointState::Type currentState = actorImpl->GetHoverState(); @@ -160,11 +160,14 @@ Dali::Actor EmitGeoHoverSignals(std::list& actorLists, c break; } } - else if(actorImpl->EmitHoverEventSignal(hoverEvent)) + else if(hoverEvent.GetState(0) != PointState::MOTION || actorImpl->IsDispatchHoverMotion()) { - // One of this actor's listeners has consumed the event so set this actor as the consumed actor. - consumedActor = Dali::Actor(actorImpl); - break; + if(actorImpl->EmitHoverEventSignal(hoverEvent)) + { + // One of this actor's listeners has consumed the event so set this actor as the consumed actor. + consumedActor = Dali::Actor(actorImpl); + break; + } } } }