(AutomatedTests) Added a touch test for checking actors that are reparented and requi... 18/24118/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 11:57:45 +0000 (12:57 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 14:14:36 +0000 (15:14 +0100)
[problem]      No test for problem fixed by:
               (Touch) Ensure leave events are emitted to an actor that's detatched then re-attached to the stage in quick succession
[cause]        N/A
[solution]     Add a test which would have failed before the specified patch.

Change-Id: I7cb24f8617e991d454afde4ae1f30908007f76a8
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
automated-tests/src/dali/tct-dali-core.h
automated-tests/src/dali/utc-Dali-TouchProcessing.cpp

index be42d9531de1cc6f5055d78874d3ce88c7d4ccc8..7a68dec5769b8379a9c913ee199e7837fd2a269e 100644 (file)
@@ -1282,6 +1282,7 @@ extern int UtcDaliTouchActorSignalNotConsumed(void);
 extern int UtcDaliTouchActorUnStaged(void);
 extern int UtcDaliTouchSystemOverlayActor(void);
 extern int UtcDaliTouchLayerConsumesTouch(void);
+extern int UtcDaliTouchLeaveActorReadded(void);
 extern int UtcDaliVector2Cons(void);
 extern int UtcDaliVector2FitInside(void);
 extern int UtcDaliVector2FitScaleToFill(void);
@@ -2515,6 +2516,7 @@ testcase tc_array[] = {
     {"UtcDaliTouchActorUnStaged", UtcDaliTouchActorUnStaged, utc_dali_touch_processing_startup, utc_dali_touch_processing_cleanup},
     {"UtcDaliTouchSystemOverlayActor", UtcDaliTouchSystemOverlayActor, utc_dali_touch_processing_startup, utc_dali_touch_processing_cleanup},
     {"UtcDaliTouchLayerConsumesTouch", UtcDaliTouchLayerConsumesTouch, utc_dali_touch_processing_startup, utc_dali_touch_processing_cleanup},
+    {"UtcDaliTouchLeaveActorReadded", UtcDaliTouchLeaveActorReadded, utc_dali_touch_processing_startup, utc_dali_touch_processing_cleanup},
     {"UtcDaliVector2Cons", UtcDaliVector2Cons, utc_dali_vector2_startup, utc_dali_vector2_cleanup},
     {"UtcDaliVector2FitInside", UtcDaliVector2FitInside, utc_dali_vector2_startup, utc_dali_vector2_cleanup},
     {"UtcDaliVector2FitScaleToFill", UtcDaliVector2FitScaleToFill, utc_dali_vector2_startup, utc_dali_vector2_cleanup},
index 0847158a4d2633b11c95241fb3d91af7f14de2ff..ebdc1540651840d772ee2fe5a20f6f96cd99808c 100644 (file)
@@ -1243,3 +1243,49 @@ int UtcDaliTouchLayerConsumesTouch(void)
 
   END_TEST;
 }
+
+int UtcDaliTouchLeaveActorReadded(void)
+{
+  TestApplication application;
+  Stage stage = Stage::GetCurrent();
+
+  Actor actor = Actor::New();
+  actor.SetSize(100.0f, 100.0f);
+  actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+  stage.Add(actor);
+
+  // Set actor to receive touch-events
+  actor.SetLeaveRequired( true );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Connect to actor's touched signal
+  SignalData data;
+  TouchEventFunctor functor( data );
+  actor.TouchedSignal().Connect( &application, functor );
+
+  // Emit a down and motion
+  application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+  application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 11.0f, 10.0f ) ) );
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  data.Reset();
+
+  // Remove actor from stage and add again
+  stage.Remove( actor );
+  stage.Add( actor );
+
+  // Emit a motion within the actor's bounds
+  application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 12.0f, 10.0f ) ) );
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  data.Reset();
+
+  // Emit a motion outside the actor's bounds
+  application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 200.0f, 200.0f ) ) );
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  DALI_TEST_EQUALS( TouchPoint::Leave, data.touchEvent.points[0].state, TEST_LOCATION );
+  data.Reset();
+
+  END_TEST;
+}