X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-LongPressGestureDetector.cpp;h=433082bce2d949e81f6007f4cdce6a3f633fc1fb;hb=refs%2Fchanges%2F82%2F24082%2F1;hp=1b04d5f084bfcb0a01caefda4008dda128e21ae8;hpb=1069b20b5392340de290f0ae9b404c81cb9cb690;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp index 1b04d5f..433082b 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp @@ -1374,3 +1374,56 @@ int UtcDaliLongPressGestureTouchBehindGesturedSystemOverlay(void) END_TEST; } + +int UtcDaliLongPressGestureLayerConsumesTouch(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); + LongPressGestureDetector detector = LongPressGestureDetector::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( GenerateLongPress( Gesture::Possible, 1u, screenCoords ) ); + application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, screenCoords ) ); + application.ProcessEvent( GenerateLongPress( Gesture::Finished, 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( GenerateLongPress( Gesture::Possible, 1u, screenCoords ) ); + application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, screenCoords ) ); + application.ProcessEvent( GenerateLongPress( Gesture::Finished, 1u, screenCoords ) ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + data.Reset(); + + END_TEST; +}