Removed TouchEvent from dali-core
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ScrollBar.cpp
index 5a2b43f..676bebd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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 <stdlib.h>
 #include <string>
 #include <dali-toolkit-test-suite-utils.h>
+#include "dali-toolkit-test-utils/toolkit-timer.h"
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -115,6 +117,8 @@ static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2
 
   for(int i = 0; i < frames; i++)
   {
+    Test::EmitGlobalTimerSignal();
+
     pos += direction; // Move in this direction
     time += RENDER_FRAME_INTERVAL;
     TestMovePan( application, pos, time);
@@ -273,11 +277,11 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void)
 
   float scrollBarHeight = 100.0f;
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) );
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -355,7 +359,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void)
 
   // Create another source actor
   Actor newSourceActor = Actor::New();
-  Stage::GetCurrent().Add( newSourceActor );
+  application.GetScene().Add( newSourceActor );
 
   // Register the scroll properties
   Property::Index newPropertyScrollPosition = newSourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -519,7 +523,7 @@ int UtcDaliToolkitScrollBarSetScrollPositionIntervalsP(void)
   scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Connect to the ScrollPositionIntervalReached signal
   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
@@ -530,7 +534,7 @@ int UtcDaliToolkitScrollBarSetScrollPositionIntervalsP(void)
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -702,11 +706,11 @@ int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void)
 
   float scrollBarHeight = 100.0f;
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) );
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -794,7 +798,7 @@ int UtcDaliToolkitScrollBarSetIndicatorFixedHeightP(void)
 
   float scrollBarHeight = 100.0f;
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) );
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -854,7 +858,7 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -934,7 +938,7 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationN(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1026,7 +1030,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1106,7 +1110,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationN(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1198,7 +1202,7 @@ int UtcDaliToolkitScrollBarShowIndicatorP(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1243,7 +1247,7 @@ int UtcDaliToolkitScrollBarShowIndicatorN(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1285,7 +1289,7 @@ int UtcDaliToolkitScrollBarHideIndicatorP(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1330,7 +1334,7 @@ int UtcDaliToolkitScrollBarHideIndicatorN(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1372,7 +1376,7 @@ int UtcDaliToolkitScrollBarActionShowIndicator(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1418,7 +1422,7 @@ int UtcDaliToolkitScrollBarActionHideIndicator(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1464,7 +1468,7 @@ int UtcDaliToolkitScrollBarActionShowTransientIndicator(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1528,7 +1532,7 @@ int UtcDaliToolkitScrollBarActionShowTransientIndicatorImmediate(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1588,7 +1592,7 @@ int UtcDaliToolkitScrollBarActionShowTransientIndicatorDuringHide(void)
   ScrollBar scrollBar = ScrollBar::New();
   DALI_TEST_CHECK( scrollBar );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   Actor indicator = scrollBar.GetScrollIndicator();
   DALI_TEST_CHECK( indicator );
@@ -1681,7 +1685,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
   scrollBar.SetIndicatorFixedHeight(50.0f);
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Connect the pan finished signal
   ConnectionTracker connectionTracker;
@@ -1695,7 +1699,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -1739,7 +1743,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void)
   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
   scrollBar.SetIndicatorFixedHeight(50.0f);
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Connect the pan finished signal
   ConnectionTracker connectionTracker;
@@ -1757,7 +1761,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void)
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -1802,7 +1806,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
   scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
   ConnectionTracker connectionTracker;
 
   // Connect to the ScrollPositionIntervalReached signal
@@ -1816,7 +1820,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
@@ -1918,7 +1922,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void)
   scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) );
 
-  Stage::GetCurrent().Add( scrollBar );
+  application.GetScene().Add( scrollBar );
 
   // Connect to the ScrollPositionIntervalReached signal
   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
@@ -1929,7 +1933,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void)
 
   // Create a source actor that owns the scroll properties required by the scroll bar
   Actor sourceActor = Actor::New();
-  Stage::GetCurrent().Add( sourceActor );
+  application.GetScene().Add( sourceActor );
 
   // Register the scroll properties
   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );