+ SignalData data;
+ GestureReceivedFunctor functor(data);
+
+ TapGestureDetector detector = TapGestureDetector::New();
+ detector.SetMaximumTapsRequired(2u);
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ // Emit signals, Because MaximumTapsRequired is 2, a timer that checks whether it is a single tap or a double tap operates internally.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 120));
+ application.SendNotification();
+
+ // So detector don't get the tap event yet.
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // Emit signals, Send the second tab.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 130));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 150));
+ application.SendNotification();
+ application.GetPlatform().TriggerTimer();
+
+ // It find out to be a double tap. Detector receives events.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // Detector want to receive all tap events.
+ detector.ReceiveAllTapEvents(true);
+
+ // Emit signals, should receive
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 500));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 520));
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // Emit signals, should receive
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 530));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 550));
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureDoesWantedHitTest(void)
+{
+ TestApplication application;
+
+ Actor blue = Actor::New();
+ blue.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ Actor green = Actor::New();
+ green.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.GetScene().Add(blue);
+ application.GetScene().Add(green);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ SignalData blueData;
+ GestureReceivedFunctor blueFunctor(blueData);
+
+ TapGestureDetector blueDetector = TapGestureDetector::New();
+ blueDetector.Attach(blue);
+ blueDetector.DetectedSignal().Connect(&application, blueFunctor);
+
+ SignalData greenData;
+ GestureReceivedFunctor greenFunctor(greenData);
+
+ TapGestureDetector greenDetector = TapGestureDetector::New();
+ greenDetector.Attach(green);
+ greenDetector.DetectedSignal().Connect(&application, greenFunctor);
+
+ // connect to its hit-test signal
+ gHitTestTouchCallBackCalled = false;
+ Dali::DevelActor::HitTestResultSignal(green).Connect(TestHitTestTouchCallback);
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 120));
+ application.SendNotification();
+
+ // check hit-test events
+ // The green actor received an event that the green actor was hit.
+ DALI_TEST_EQUALS(true, gHitTestTouchCallBackCalled, TEST_LOCATION);
+
+ // The green actor passed the hit-test. So blue was the final hit.
+ DALI_TEST_EQUALS(false, greenData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, blueData.functorCalled, TEST_LOCATION);
+
+ blueData.Reset();
+ greenData.Reset();
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureDetectorCheck(void)
+{
+ TestApplication application;
+
+ 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);
+
+ Actor actor2 = Actor::New();
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor2);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector1 = TapGestureDetector::New();
+ detector1.SetMaximumTapsRequired(1u);
+ detector1.Attach(actor);
+ detector1.DetectedSignal().Connect(&application, functor);
+
+ TapGestureDetector detector2 = TapGestureDetector::New();
+ detector2.SetMaximumTapsRequired(2u);
+ detector2.Attach(actor2);
+
+ // Emit signals, Send the single tab.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 120));
+ application.SendNotification();
+
+ // The detector1 get the tap event.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // Emit signals, Send the second tab.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 130));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 150));
+ application.SendNotification();
+
+ // The detector1 must get the tap event. SetMaximumTapsRequired(2u) of detector2 should not affect detector1.