Fix miss implements of MapView touch patch + UTC for mutli exclusive touch 20/301120/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 9 Nov 2023 04:31:46 +0000 (13:31 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 9 Nov 2023 05:02:30 +0000 (14:02 +0900)
Change-Id: I91906db2f756441dd059abf76d283aee858f0b84
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp
dali/internal/event/events/hit-test-algorithm-impl.cpp

index 4d102c1..44e8c22 100644 (file)
@@ -625,7 +625,70 @@ int UtcDaliHitTestAlgorithmOrder(void)
 
   HitTestAlgorithm::Results results;
   HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction);
-  DALI_TEST_CHECK(results.actor == blue);
+  DALI_TEST_CHECK(results.actor == green);
+
+  END_TEST;
+}
+
+int UtcDaliHitTestAlgorithmExclusiveMultiple(void)
+{
+  TestApplication application;
+  tet_infoline("Testing Dali::HitTestAlgorithm between On/Off render task with multiple exclusived");
+
+  Stage   stage = Stage::GetCurrent();
+  Vector2 stageSize(stage.GetSize());
+
+  Actor blue                                        = Actor::New();
+  blue[Dali::Actor::Property::NAME]                 = "Blue";
+  blue[Dali::Actor::Property::ANCHOR_POINT]         = AnchorPoint::CENTER;
+  blue[Dali::Actor::Property::PARENT_ORIGIN]        = ParentOrigin::CENTER;
+  blue[Dali::Actor::Property::WIDTH_RESIZE_POLICY]  = ResizePolicy::FILL_TO_PARENT;
+  blue[Dali::Actor::Property::HEIGHT_RESIZE_POLICY] = ResizePolicy::FILL_TO_PARENT;
+
+  Actor green                                        = Actor::New();
+  green[Dali::Actor::Property::NAME]                 = "Green";
+  green[Dali::Actor::Property::ANCHOR_POINT]         = AnchorPoint::CENTER;
+  green[Dali::Actor::Property::PARENT_ORIGIN]        = ParentOrigin::CENTER;
+  green[Dali::Actor::Property::WIDTH_RESIZE_POLICY]  = ResizePolicy::FILL_TO_PARENT;
+  green[Dali::Actor::Property::HEIGHT_RESIZE_POLICY] = ResizePolicy::FILL_TO_PARENT;
+
+  stage.Add(blue);
+  stage.Add(green);
+
+  RenderTaskList renderTaskList = stage.GetRenderTaskList();
+  RenderTask     offRenderTask  = renderTaskList.CreateTask();
+  RenderTask     offRenderTask2 = renderTaskList.CreateTask();
+
+  Dali::CameraActor cameraActor                     = Dali::CameraActor::New(stageSize);
+  cameraActor[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::CENTER;
+  cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+  stage.Add(cameraActor);
+
+  offRenderTask.SetExclusive(true);
+  offRenderTask.SetInputEnabled(true);
+  offRenderTask.SetCameraActor(cameraActor);
+  offRenderTask.SetSourceActor(green);
+  offRenderTask.SetScreenToFrameBufferMappingActor(green);
+
+  Dali::Texture texture      = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, unsigned(stageSize.width), unsigned(stageSize.height));
+  FrameBuffer   renderTarget = FrameBuffer::New(stageSize.width, stageSize.height, FrameBuffer::Attachment::DEPTH);
+  renderTarget.AttachColorTexture(texture);
+  offRenderTask.SetFrameBuffer(renderTarget);
+
+  offRenderTask2.SetExclusive(true);
+  offRenderTask2.SetInputEnabled(true);
+  offRenderTask2.SetCameraActor(cameraActor);
+  offRenderTask2.SetSourceActor(green);
+  offRenderTask2.SetScreenToFrameBufferMappingActor(green);
+  offRenderTask2.SetFrameBuffer(renderTarget);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(10);
+
+  HitTestAlgorithm::Results results;
+  HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction);
+  DALI_TEST_CHECK(results.actor == green);
 
   END_TEST;
 }
index 784b40f..ef398e2 100644 (file)
@@ -157,7 +157,8 @@ bool IsActorExclusiveToAnotherRenderTask(const Actor&
         }
         else
         {
-          return true;
+          // Fast-out if render task is itself
+          return false;
         }
       }
     }
@@ -490,8 +491,8 @@ bool HitTestRenderTask(const RenderTaskList::ExclusivesContainer& exclusives,
 
         // Hit test starting with the top layer, working towards the bottom layer.
         HitActor hit;
-        bool     overlayHit           = false;
-        bool     layerConsumesHit     = false;
+        bool     overlayHit       = false;
+        bool     layerConsumesHit = false;
 
         // Be used when we decide to consume layer.
         // We should not consume hit if sourceLayer is above on consumable layer. Otherwise, we should consume. So just initialize it as 0.
@@ -499,14 +500,14 @@ bool HitTestRenderTask(const RenderTaskList::ExclusivesContainer& exclusives,
         // If the layer is consumed first, sourceLayerIndex is not the actual index, but it must be guaranteed to have an index smaller than the layer.
         // If there is a sourceLayer above the consumable layer, the sourceLayerIndex is determined and the index of the consumable layer is also determined.
         // Then we can calculate the relationship between the two layers.
-        bool     IsHitTestWithinLayer = false;
-        int32_t  sourceLayerIndex     = 0;
-        int32_t  consumedLayerIndex   = -1;
+        bool    IsHitTestWithinLayer = false;
+        int32_t sourceLayerIndex     = 0;
+        int32_t consumedLayerIndex   = -1;
 
         for(int32_t i = layers.GetLayerCount() - 1; i >= 0 && !(hit.actor); --i)
         {
           Layer* layer(layers.GetLayer(i));
-          overlayHit = false;
+          overlayHit           = false;
           IsHitTestWithinLayer = false;
 
           if(sourceLayer == layer)
@@ -561,7 +562,7 @@ bool HitTestRenderTask(const RenderTaskList::ExclusivesContainer& exclusives,
             if(IsHitTestWithinLayer && hitCheck.DoesLayerConsumeHit(layer))
             {
               consumedLayerIndex = i;
-              layerConsumesHit = true;
+              layerConsumesHit   = true;
               break;
             }
           }