Move TouchPoint to Devel API
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Tooltip.cpp
index 6eabaed..b1cf510 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.
@@ -50,7 +50,7 @@ void utc_dali_toolkit_tooltip_cleanup(void)
 namespace
 {
 
-Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
+Integration::HoverEvent GenerateSingleHover( PointState::Type state, const Vector2& screenPosition )
 {
   Integration::HoverEvent hoverEvent;
   Integration::Point point;
@@ -512,7 +512,7 @@ int UtcDaliTooltipDisplay(void)
   control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
   control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -520,8 +520,8 @@ int UtcDaliTooltipDisplay(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -533,7 +533,7 @@ int UtcDaliTooltipDisplay(void)
   ++rootChildCount;
   DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
 
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Stationary, centerPoint ) ); // Emit for code coverage, will have no effect
+  application.ProcessEvent( GenerateSingleHover( PointState::STATIONARY, centerPoint ) ); // Emit for code coverage, will have no effect
 
   END_TEST;
 }
@@ -554,7 +554,7 @@ int UtcDaliTooltipDisplayWithTail(void)
                                                            .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -562,8 +562,8 @@ int UtcDaliTooltipDisplayWithTail(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -598,7 +598,7 @@ int UtcDaliTooltipDisplayWithContentArray(void)
                                                            .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -606,8 +606,8 @@ int UtcDaliTooltipDisplayWithContentArray(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -635,14 +635,14 @@ int UtcDaliTooltipDisplayBelow(void)
                                       .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
   application.Render();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -671,14 +671,14 @@ int UtcDaliTooltipDisplayAbove(void)
                                       .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
   application.Render();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -707,17 +707,17 @@ int UtcDaliTooltipDisplayAtHoverPoint(void)
                                       .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
   application.Render();
 
-  const Vector2 stageSize = Stage::GetCurrent().GetSize();
+  const Vector2 stageSize = application.GetScene().GetSize();
   Vector2 hoverPoint = stageSize * 0.5f;
   hoverPoint.x -= 10.0f;
   hoverPoint.y -= 10.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -747,7 +747,7 @@ int UtcDaliTooltipExceedThreshold(void)
                                       .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -756,15 +756,15 @@ int UtcDaliTooltipExceedThreshold(void)
   int rootChildCount = rootActor.GetChildCount();
 
   tet_infoline( "Start hover" );
-  Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+  Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
 
   tet_infoline( "Emit a value which exceeds threshold, timer should start again" );
   hoverPoint.x += 10.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
@@ -793,7 +793,7 @@ int UtcDaliTooltipGoOutOfBounds(void)
   control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
   control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -802,15 +802,15 @@ int UtcDaliTooltipGoOutOfBounds(void)
   int rootChildCount = rootActor.GetChildCount();
 
   tet_infoline( "Start hover" );
-  Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+  Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
 
   tet_infoline( "Emit a value which goes out of bounds" );
   hoverPoint.x += 100.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
@@ -838,7 +838,7 @@ int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
   control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
   control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -846,8 +846,8 @@ int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+  Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -860,7 +860,7 @@ int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
   DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
 
   hoverPoint.x += 100.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
@@ -886,7 +886,7 @@ int UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
                                       .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -894,8 +894,8 @@ int UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
+  Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, hoverPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -908,7 +908,7 @@ int UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
   DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
 
   hoverPoint.x += 10.0f; // Stay within bounds but exceed threshold
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::MOTION, hoverPoint ) );
 
   application.SendNotification();
   application.Render();
@@ -930,7 +930,7 @@ int UtcDaliTooltipChangeContent(void)
   control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
   control.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -938,8 +938,8 @@ int UtcDaliTooltipChangeContent(void)
 
   int rootChildCount = rootActor.GetChildCount();
 
-  Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   tet_infoline( "Change content while timer is running and ensure it matches the new value" );
   control.SetProperty( DevelControl::Property::TOOLTIP, "Second Value" );
@@ -967,7 +967,7 @@ int UtcDaliTooltipChangeContent(void)
   DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
 
   tet_infoline( "More movement at same point, and emit signal, we should get the tooltip" );
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, centerPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::MOTION, centerPoint ) );
   timer.MockEmitSignal();
 
   application.SendNotification();
@@ -1009,7 +1009,7 @@ int UtcDaliTooltipEnsureRemainsOnStage1(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
+  Vector2 stageSize = application.GetScene().GetSize();
 
   tet_infoline( "Create a control and place it at the bottom of the screen, setting the tooltip to appear below" );
   Control control = Control::New();
@@ -1025,14 +1025,14 @@ int UtcDaliTooltipEnsureRemainsOnStage1(void)
                                       .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
   application.Render();
 
   Vector2 centerPoint = stageSize * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -1051,7 +1051,7 @@ int UtcDaliTooltipEnsureRemainsOnStage2(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
+  Vector2 stageSize = application.GetScene().GetSize();
 
   tet_infoline( "Create a control and place it at the top of the screen, setting the tooltip to appear above" );
   Control control = Control::New();
@@ -1067,14 +1067,14 @@ int UtcDaliTooltipEnsureRemainsOnStage2(void)
                                       .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
                      );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
   application.Render();
 
   Vector2 centerPoint = stageSize * 0.5f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -1093,7 +1093,7 @@ int UtcDaliTooltipEnsureRemainsOnStage3(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
+  Vector2 stageSize = application.GetScene().GetSize();
   Vector2 centerPoint = stageSize * 0.5f;
 
   tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the left of the screen" );
@@ -1111,7 +1111,7 @@ int UtcDaliTooltipEnsureRemainsOnStage3(void)
                      );
   control.SetProperty( Actor::Property::POSITION_X,  -centerPoint.x );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -1119,7 +1119,7 @@ int UtcDaliTooltipEnsureRemainsOnStage3(void)
 
   Vector2 hoverPoint( centerPoint );
   hoverPoint.x = 1.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();
@@ -1138,7 +1138,7 @@ int UtcDaliTooltipEnsureRemainsOnStage4(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
+  Vector2 stageSize = application.GetScene().GetSize();
   Vector2 centerPoint = stageSize * 0.5f;
 
   tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the right of the screen" );
@@ -1156,7 +1156,7 @@ int UtcDaliTooltipEnsureRemainsOnStage4(void)
                      );
   control.SetProperty( Actor::Property::POSITION_X,  centerPoint.x );
 
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor = application.GetScene().GetRootLayer();
   rootActor.Add( control );
 
   application.SendNotification();
@@ -1164,7 +1164,7 @@ int UtcDaliTooltipEnsureRemainsOnStage4(void)
 
   Vector2 hoverPoint( centerPoint );
   hoverPoint.x = 1.0f;
-  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
+  application.ProcessEvent( GenerateSingleHover( PointState::STARTED, centerPoint ) );
 
   Dali::Timer timer = Timer::New( 1u );
   timer.MockEmitSignal();