[Tizen] When hoverevent of geometry type is used, DispatchHoverMotion is not handled... 70/321170/1
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 13 Mar 2025 04:33:53 +0000 (13:33 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 17 Mar 2025 01:57:10 +0000 (10:57 +0900)
Change-Id: Ibcd68776f55a6779485a36d2d17b030801225b7f

automated-tests/src/dali/utc-Dali-GeoHoverProcessing.cpp
dali/internal/event/events/hover-event-processor.cpp

index 556ec78ae01ce449b5b839b20cfeedafe1f9d562..ab6c715f1352e699c7f7e27d246b3d524a0cbb9f 100644 (file)
@@ -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;
index ca2925a90e1688f51c5fec7bee05352dcc44eadd..f3d89bb02f56e9f9f215bf5be87ae7985113179e 100644 (file)
@@ -141,7 +141,7 @@ Dali::Actor EmitGeoHoverSignals(std::list<Dali::Internal::Actor*>& 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<Dali::Internal::Actor*>& 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;
+        }
       }
     }
   }