Removed On(...)Event()
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ControlImpl.cpp
index 6150385..a3ed827 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
-#include <dali/integration-api/events/long-press-gesture-event.h>
-#include <dali/integration-api/events/pinch-gesture-event.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 
@@ -76,19 +72,19 @@ int UtcDaliControlImplEnableGestureDetector(void)
     DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
 
     DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
-    dummyImpl.EnableGestureDetection(Gesture::Pinch);
+    dummyImpl.EnableGestureDetection(GestureType::PINCH);
     DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
 
     DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
-    dummyImpl.EnableGestureDetection(Gesture::Pan);
+    dummyImpl.EnableGestureDetection(GestureType::PAN);
     DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
 
     DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
-    dummyImpl.EnableGestureDetection(Gesture::Tap);
+    dummyImpl.EnableGestureDetection(GestureType::TAP);
     DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
 
     DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
-    dummyImpl.EnableGestureDetection(Gesture::LongPress);
+    dummyImpl.EnableGestureDetection(GestureType::LONG_PRESS);
     DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
   }
 
@@ -102,7 +98,7 @@ int UtcDaliControlImplEnableGestureDetector(void)
     DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
     DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
 
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
     DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
@@ -111,7 +107,7 @@ int UtcDaliControlImplEnableGestureDetector(void)
 
     // Enable when already enabled
 
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
     DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
@@ -130,22 +126,22 @@ int UtcDaliControlImplDisableGestureDetector(void)
     DummyControl dummy = DummyControl::New();
     DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
 
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
-    dummyImpl.DisableGestureDetection(Gesture::Pinch);
+    dummyImpl.DisableGestureDetection(GestureType::PINCH);
     DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
 
     DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
-    dummyImpl.DisableGestureDetection(Gesture::Pan);
+    dummyImpl.DisableGestureDetection(GestureType::PAN);
     DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
 
     DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
-    dummyImpl.DisableGestureDetection(Gesture::Tap);
+    dummyImpl.DisableGestureDetection(GestureType::TAP);
     DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
 
     DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
-    dummyImpl.DisableGestureDetection(Gesture::LongPress);
+    dummyImpl.DisableGestureDetection(GestureType::LONG_PRESS);
     DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
   }
 
@@ -154,14 +150,14 @@ int UtcDaliControlImplDisableGestureDetector(void)
     DummyControl dummy = DummyControl::New();
     DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
 
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
     DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
     DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
     DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
 
-    dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
     DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
@@ -179,7 +175,7 @@ int UtcDaliControlImplDisableGestureDetector(void)
     DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
     DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
 
-    dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
     DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
@@ -192,7 +188,7 @@ int UtcDaliControlImplDisableGestureDetector(void)
     DummyControl dummy = DummyControl::New();
     DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
 
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
     PanGestureDetector pan   = dummyImpl.GetPanGestureDetector();
@@ -204,7 +200,7 @@ int UtcDaliControlImplDisableGestureDetector(void)
     DALI_TEST_EQUALS( 0 == tap.GetAttachedActorCount(), false, TEST_LOCATION );
     DALI_TEST_EQUALS( 0 == longPress.GetAttachedActorCount(), false, TEST_LOCATION );
 
-    dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_EQUALS( 0 == pinch.GetAttachedActorCount(), true, TEST_LOCATION );
     DALI_TEST_EQUALS( 0 == pan.GetAttachedActorCount(), true, TEST_LOCATION );
@@ -221,10 +217,10 @@ int UtcDaliControlImplOnGestureMethods(void)
   // Check gesture actually happens
   {
     DummyControl dummy = DummyControl::New(true);
-    dummy.SetSize( Vector2(100.0f, 100.0f ) );
+    dummy.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f ) );
 
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
+    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+    application.GetScene().Add(dummy);
 
     // Render and notify a couple of times
     application.SendNotification();
@@ -233,110 +229,35 @@ int UtcDaliControlImplOnGestureMethods(void)
     application.Render();
 
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) );
 
     DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
-    Integration::PinchGestureEvent pinch(Gesture::Started);
-    pinch.scale = 10.0f;
-    pinch.speed = 50.0f;
-    pinch.centerPoint = Vector2(20.0f, 20.0f);
-    application.ProcessEvent(pinch);
+
+    TestGeneratePinch(application);
+
     DALI_TEST_CHECK( dummyImpl.pinchCalled == true );
 
     DALI_TEST_CHECK( dummyImpl.panCalled == false );
-    Integration::PanGestureEvent pan(Gesture::Possible);
-    pan.previousPosition = Vector2(10.0f, 20.0f);
-    pan.currentPosition = Vector2(20.0f, 20.0f);
-    pan.timeDelta = 10;
-    pan.numberOfTouches = 1u;
-    application.ProcessEvent(pan);
-    pan.state = Gesture::Started;
-    application.ProcessEvent(pan);
+
+    TestGenerateMiniPan(application);
+
     DALI_TEST_CHECK( dummyImpl.panCalled == true );
 
     DALI_TEST_CHECK( dummyImpl.tapCalled == false );
-    Integration::TapGestureEvent tap(Gesture::Possible);
-    tap.numberOfTaps = 1u;
-    tap.numberOfTouches = 1u;
-    tap.point = Vector2(50.0f, 50.0f);
-    application.ProcessEvent(tap);
-    tap.state = Gesture::Started;
-    application.ProcessEvent(tap);
-    DALI_TEST_CHECK( dummyImpl.tapCalled == true );
 
-    DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
-    Integration::LongPressGestureEvent longPress(Gesture::Possible);
-    longPress.numberOfTouches = 1u;
-    longPress.point = Vector2(50.0f, 50.0f);
-    application.ProcessEvent(longPress);
-    longPress.state = Gesture::Started;
-    application.ProcessEvent(longPress);
-    DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
-    longPress.state = Gesture::Finished;
-    application.ProcessEvent(longPress);
+    TestGenerateTap(application);
 
-    Stage::GetCurrent().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
+    DALI_TEST_CHECK( dummyImpl.tapCalled == true );
 
-    // Render and notify a couple of times
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-    application.Render();
+    DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
 
-    DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
-    dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+    TestGenerateLongPress(application);
 
-    DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
-    Integration::PinchGestureEvent pinch(Gesture::Started);
-    pinch.scale = 10.0f;
-    pinch.speed = 50.0f;
-    pinch.centerPoint = Vector2(20.0f, 20.0f);
-    application.ProcessEvent(pinch);
+    DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
 
-    // Render and notify a couple of times
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
-
-    Integration::PanGestureEvent pan(Gesture::Possible);
-    pan.previousPosition = Vector2(10.0f, 20.0f);
-    pan.currentPosition = Vector2(20.0f, 20.0f);
-    pan.timeDelta = 10;
-    pan.numberOfTouches = 1u;
-    application.ProcessEvent(pan);
-    pan.state = Gesture::Started;
-    application.ProcessEvent(pan);
-
-    Integration::TapGestureEvent tap(Gesture::Possible);
-    tap.numberOfTaps = 1u;
-    tap.numberOfTouches = 1u;
-    tap.point = Vector2(50.0f, 50.0f);
-    application.ProcessEvent(tap);
-    tap.state = Gesture::Started;
-    application.ProcessEvent(tap);
-
-    Integration::LongPressGestureEvent longPress(Gesture::Possible);
-    longPress.numberOfTouches = 1u;
-    longPress.point = Vector2(50.0f, 50.0f);
-    application.ProcessEvent(longPress);
-    longPress.state = Gesture::Started;
-    application.ProcessEvent(longPress);
-    longPress.state = Gesture::Finished;
-    application.ProcessEvent(longPress);
-
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
+
   END_TEST;
 }
 
@@ -346,7 +267,7 @@ int UtcDaliControlImplChildAddAndRemove(void)
 
   {
     DummyControl dummy = DummyControl::New( true );
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
     application.Render();
@@ -370,13 +291,13 @@ int UtcDaliControlImplChildAddAndRemove(void)
     application.Render();
     application.SendNotification();
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   // Ensure full code coverage
   {
     DummyControl dummy = DummyControl::New();
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     application.Render();
     application.SendNotification();
@@ -395,7 +316,7 @@ int UtcDaliControlImplChildAddAndRemove(void)
     application.Render();
     application.SendNotification();
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -409,13 +330,13 @@ int UtcDaliControlImplStageConnection(void)
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
     DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     application.Render();
     application.SendNotification();
     DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
 
     DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
     application.Render();
     application.SendNotification();
     DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
@@ -423,19 +344,19 @@ int UtcDaliControlImplStageConnection(void)
 
   // Ensure full code coverage
   {
-    unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
+    unsigned int stageChildren = application.GetScene().GetLayer(0).GetChildCount();
     DummyControl dummy = DummyControl::New();
 
-    DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
-    Stage::GetCurrent().Add(dummy);
+    DALI_TEST_EQUALS( application.GetScene().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+    application.GetScene().Add(dummy);
     application.Render();
     application.SendNotification();
-    DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetScene().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
     application.Render();
     application.SendNotification();
-    DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+    DALI_TEST_EQUALS( application.GetScene().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
   }
   END_TEST;
 }
@@ -448,23 +369,23 @@ int UtcDaliControlImplSizeSetP(void)
     DummyControl dummy = DummyControl::New( true );
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     application.Render();
     application.SendNotification();
 
     DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size not set, no onSizeSet called
     Vector2 size(100.0f, 200.0f);
-    dummy.SetSize( size );
+    dummy.SetProperty( Actor::Property::SIZE, size );
 
     DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size is going to get negotiated, no onSizeSet called
 
     application.SendNotification();
     application.Render();
 
-    DALI_TEST_EQUALS( size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION );
+    DALI_TEST_EQUALS( size, dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY(), TEST_LOCATION );
     DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   END_TEST;
@@ -476,22 +397,22 @@ int UtcDaliControlImplSizeSet2P(void)
 
   {
     DummyControl dummy = DummyControl::New();
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     Vector2 size(100.0f, 200.0f);
-    DALI_TEST_CHECK( size != dummy.GetCurrentSize().GetVectorXY() );
+    DALI_TEST_CHECK( size != dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY() );
 
     application.SendNotification();
     application.Render();
 
-    dummy.SetSize(size);
+    dummy.SetProperty( Actor::Property::SIZE, size);
 
     application.SendNotification();
     application.Render();
 
-    DALI_TEST_EQUALS(size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION);
+    DALI_TEST_EQUALS(size, dummy.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY(), TEST_LOCATION);
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -505,7 +426,7 @@ int UtcDaliControlImplSizeAnimation(void)
     DummyControl dummy = DummyControl::New( true );
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
     Animation animation = Animation::New(1.0f);
@@ -519,14 +440,14 @@ int UtcDaliControlImplSizeAnimation(void)
 
     DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   // Ensure full code coverage
   {
     DummyControl dummy = DummyControl::New();
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     Animation animation = Animation::New(1.0f);
     animation.AnimateTo( Property( dummy, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );
@@ -537,128 +458,13 @@ int UtcDaliControlImplSizeAnimation(void)
     application.Render();
     application.SendNotification();
 
-    Stage::GetCurrent().Remove(dummy);
-  }
-  END_TEST;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-int UtcDaliControlImplTouchEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
-    Integration::TouchEvent touchEvent(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::DOWN );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    touchEvent.AddPoint(point);
-    application.ProcessEvent(touchEvent);
-    DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
-
-    Stage::GetCurrent().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    Integration::TouchEvent touchEvent(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::DOWN );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    touchEvent.AddPoint(point);
-    application.ProcessEvent(touchEvent);
-
-    Stage::GetCurrent().Remove(dummy);
-  }
-  END_TEST;
-}
-
-int UtcDaliControlImplHoverEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, false, TEST_LOCATION );
-    Integration::HoverEvent event(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::MOTION );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    event.AddPoint(point);
-    application.ProcessEvent( event );
-    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, true, TEST_LOCATION );
-
-    Stage::GetCurrent().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    Integration::HoverEvent event(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::MOTION );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    event.AddPoint(point);
-    application.ProcessEvent( event );
-
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-
 int UtcDaliControlImplKeyEvent(void)
 {
   ToolkitTestApplication application;
@@ -667,7 +473,7 @@ int UtcDaliControlImplKeyEvent(void)
     DummyControl dummy = DummyControl::New( true );
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     dummy.SetKeyInputFocus();
 
     application.Render();
@@ -680,14 +486,14 @@ int UtcDaliControlImplKeyEvent(void)
     application.ProcessEvent(keyEvent);
     DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   // Ensure full code coverage
   {
     DummyControl dummy = DummyControl::New();
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     dummy.SetKeyInputFocus();
 
     application.Render();
@@ -698,7 +504,7 @@ int UtcDaliControlImplKeyEvent(void)
     Integration::KeyEvent keyEvent;
     application.ProcessEvent(keyEvent);
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -711,7 +517,7 @@ int UtcDaliControlImplKeyInputFocusGained(void)
     DummyControl dummy = DummyControl::New( true );
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
 
@@ -719,16 +525,16 @@ int UtcDaliControlImplKeyInputFocusGained(void)
 
     DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   // Ensure full code coverage
   {
     DummyControl dummy = DummyControl::New();
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     dummy.SetKeyInputFocus();
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -741,7 +547,7 @@ int UtcDaliControlImplKeyInputFocusLost(void)
     DummyControl dummy = DummyControl::New( true );
     Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
 
     DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION );
 
@@ -750,14 +556,14 @@ int UtcDaliControlImplKeyInputFocusLost(void)
 
     DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
 
   // Ensure full code coverage
   {
     DummyControl dummy = DummyControl::New();
 
-    Stage::GetCurrent().Add(dummy);
+    application.GetScene().Add(dummy);
     dummy.SetKeyInputFocus();
     dummy.ClearKeyInputFocus();
 
@@ -766,7 +572,7 @@ int UtcDaliControlImplKeyInputFocusLost(void)
     dummyImpl.IsKeyboardNavigationSupported();
     dummyImpl.IsKeyboardFocusGroup();
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -789,68 +595,6 @@ int UtcDaliControlImplTypeRegistry(void)
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-namespace
-{
-static bool WheelEventCallback(Actor actor, const WheelEvent& event)
-{
-  return false;
-}
-}
-
-int UtcDaliControlImplWheelEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    dummy.WheelEventSignal().Connect(&WheelEventCallback);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, false, TEST_LOCATION );
-
-    // simulate a wheel event
-    Vector2 screenCoordinates( 10.0f, 10.0f );
-    Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
-    application.ProcessEvent( event );
-    DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, true, TEST_LOCATION );
-
-    Stage::GetCurrent().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
-
-    dummy.WheelEventSignal().Connect(&WheelEventCallback);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    // simulate a wheel event
-    Vector2 screenCoordinates( 20.0f, 20.0f );
-    Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
-    application.ProcessEvent( event );
-
-    Stage::GetCurrent().Remove(dummy);
-  }
-  END_TEST;
-}
 
 int UtcDaliControlImplSetStyleName(void)
 {
@@ -859,15 +603,15 @@ int UtcDaliControlImplSetStyleName(void)
   {
     DummyControl dummy = DummyControl::New( true );
 
-    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
-    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    Stage::GetCurrent().Add(dummy);
+    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+    application.GetScene().Add(dummy);
 
     dummy.SetStyleName("TestStyle");
 
     DALI_TEST_CHECK( dummy.GetStyleName() == "TestStyle" );
 
-    Stage::GetCurrent().Remove(dummy);
+    application.GetScene().Remove(dummy);
   }
   END_TEST;
 }
@@ -900,16 +644,6 @@ int UtcDaliControlImplOnAccessibilityPanP(void)
   END_TEST;
 }
 
-int UtcDaliControlImplOnAccessibilityTouchP(void)
-{
-  ToolkitTestApplication application;
-  Control dummy = Control::New();
-  Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy );
-  TouchEvent touch;
-  DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityTouch( touch ), TEST_LOCATION );
-
-  END_TEST;
-}
 
 int UtcDaliControlImplOnAccessibilityActivatedP(void)
 {
@@ -1025,7 +759,7 @@ int UtcDaliControlImplRegisterVisualToSelf(void)
 {
   ToolkitTestApplication application;
 
-  Test::ObjectDestructionTracker objectDestructionTracker;
+  Test::ObjectDestructionTracker objectDestructionTracker( application.GetCore().GetObjectRegistry() );
 
   {
     DummyControl dummy = DummyControl::New();
@@ -1119,7 +853,7 @@ int UtcDaliControlImplRegisterUnregisterVisual(void)
   dummyImpl.RegisterVisual( index, visual );
 
   tet_infoline( "Add control with visual to stage and check renderer count is 1" );
-  Stage::GetCurrent().Add( dummy );
+  application.GetScene().Add( dummy );
   application.SendNotification();
   application.Render();
 
@@ -1130,7 +864,7 @@ int UtcDaliControlImplRegisterUnregisterVisual(void)
   dummyImpl.UnregisterVisual( index );
 
   tet_infoline( "Remove control with visual from stage and check renderer count is 0" );
-  Stage::GetCurrent().Remove( dummy );
+  application.GetScene().Remove( dummy );
   application.SendNotification();
   application.Render();
 
@@ -1165,7 +899,7 @@ int UtcDaliControlImplRegisterDisabledVisual(void)
   DALI_TEST_CHECK( dummyImpl.GetVisual( TEST_PROPERTY ) == visual );
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY ) == false );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
 
   // Render and notify
   application.SendNotification();
@@ -1173,7 +907,7 @@ int UtcDaliControlImplRegisterDisabledVisual(void)
 
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY ) == false );
 
-  DALI_TEST_CHECK( dummy.OnStage() == true );
+  DALI_TEST_CHECK( dummy.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true );
 
   dummyImpl.EnableVisual( TEST_PROPERTY, true );
 
@@ -1204,7 +938,7 @@ int UtcDaliControlImplDisableRegisteredVisual(void)
   // Register index with a color visual
   dummyImpl.RegisterVisual( TEST_PROPERTY, visual );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
 
   // Render and notify
   application.SendNotification();
@@ -1212,7 +946,7 @@ int UtcDaliControlImplDisableRegisteredVisual(void)
 
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY ) == true);
 
-  DALI_TEST_CHECK( dummy.OnStage() == true );
+  DALI_TEST_CHECK( dummy.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true );
 
   dummyImpl.EnableVisual( TEST_PROPERTY, false );
 
@@ -1246,13 +980,13 @@ int UtcDaliControlImplEnabledVisualParentRemovedFromStage(void)
   // Register index with a color visual
   dummyImpl.RegisterVisual( TEST_PROPERTY, visual, false );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
 
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY ) == false );
-  DALI_TEST_CHECK( dummy.OnStage() == true );
+  DALI_TEST_CHECK( dummy.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true );
   dummyImpl.EnableVisual( TEST_PROPERTY, true );
 
   // Render and notify
@@ -1261,13 +995,13 @@ int UtcDaliControlImplEnabledVisualParentRemovedFromStage(void)
   DALI_TEST_CHECK( dummy.GetRendererCount() == 1u );
 
   // Remove control from stage, visual should be removed from stage too
-  Stage::GetCurrent().Remove(dummy);
+  application.GetScene().Remove(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
   DALI_TEST_CHECK( dummy.GetRendererCount() == 0u );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
@@ -1316,7 +1050,7 @@ int UtcDaliControlImplRegisterTwoVisualsAndEnableOnlyOne(void)
   // Register second index with a color visual
   dummyImpl.RegisterVisual( TEST_PROPERTY2, visual2 );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
@@ -1324,7 +1058,7 @@ int UtcDaliControlImplRegisterTwoVisualsAndEnableOnlyOne(void)
   DALI_TEST_CHECK( dummy.GetRendererCount() == 2u );
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY1 ) == true );
   DALI_TEST_CHECK( dummyImpl.IsVisualEnabled( TEST_PROPERTY1 ) == true);
-  DALI_TEST_CHECK( dummy.OnStage() == true );
+  DALI_TEST_CHECK( dummy.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true );
   dummyImpl.EnableVisual( TEST_PROPERTY2, false );
 
   // Render and notify
@@ -1333,13 +1067,13 @@ int UtcDaliControlImplRegisterTwoVisualsAndEnableOnlyOne(void)
   DALI_TEST_CHECK( dummy.GetRendererCount() == 1u );
 
   // Remove control from stage, visual should be removed from stage too
-  Stage::GetCurrent().Remove(dummy);
+  application.GetScene().Remove(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
   DALI_TEST_CHECK( dummy.GetRendererCount() == 0u );
 
-  Stage::GetCurrent().Add(dummy);
+  application.GetScene().Add(dummy);
   // Render and notify
   application.SendNotification();
   application.Render();
@@ -1372,7 +1106,7 @@ int UtcDaliControlImplAutoClippingWithVisuals(void)
 
   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
 
-  Stage::GetCurrent().Add( control );
+  application.GetScene().Add( control );
 
   application.SendNotification();
   application.Render();
@@ -1402,7 +1136,7 @@ int UtcDaliControlImplAutoClippingWithVisualsAlreadyOnStage(void)
 
   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
 
-  Stage::GetCurrent().Add( control );
+  application.GetScene().Add( control );
 
   application.SendNotification();
   application.Render();
@@ -1416,3 +1150,28 @@ int UtcDaliControlImplAutoClippingWithVisualsAlreadyOnStage(void)
 
   END_TEST;
 }
+
+int UtcDaliControlImplOnPinch(void)
+{
+  ToolkitTestApplication application;
+
+  Control control = Control::New();
+  control.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+  control.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+  application.GetScene().Add(control);
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::Control& impl = Toolkit::Internal::GetImplementation(control);
+  impl.EnableGestureDetection(GestureType::PINCH);
+
+  // Scale becomes 0.6666666
+  TestStartPinch( application,  Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ),
+                                Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+
+  DALI_TEST_EQUALS(0.666f, control.GetProperty( Actor::Property::SCALE_X).Get<float>(), 0.01f, TEST_LOCATION);
+
+  END_TEST;
+
+}