Revert "Revert "Remove ScrollViewCustomEffect""
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ScrollViewEffect.cpp
index 9c89b59..8e9224c 100644 (file)
@@ -42,12 +42,6 @@ void utc_dali_toolkit_scroll_view_effect_cleanup(void)
 
 namespace
 {
-static bool gObjectCreatedCallBackCalled;
-
-static void TestCallback(BaseHandle handle)
-{
-  gObjectCreatedCallBackCalled = true;
-}
 
 const int MILLISECONDS_PER_SECOND = 1000;
 const int RENDER_FRAME_INTERVAL = 16;                           ///< Duration of each frame in ms. (at approx 60FPS)
@@ -100,10 +94,6 @@ RulerPtr CreateRuler(float gridSize = 0.0f)
 static bool gOnScrollStartCalled;                       ///< Whether the OnScrollStart signal was invoked.
 static bool gOnScrollUpdateCalled;                      ///< Whether the OnScrollUpdate signal was invoked.
 static bool gOnScrollCompleteCalled;                    ///< Whether the OnScrollComplete signal was invoked.
-static bool gOnScrollClampedCalled;                     ///< Whether the OnScrollClamped signal was invoked.
-static bool gOnSnapStartCalled;                         ///< Whether the OnSnapStart signal was invoked.
-static ClampState3 gLastClampPosition;                  ///< Clamping information from OnScrollClampedEvent.
-static SnapType gLastSnapType;                          ///< Snaping information from SnapEvent.
 static Vector3 gConstraintResult;                       ///< Result from constraint.
 
 static ActorContainer gPages;                                ///< Keeps track of all the pages for applying effects.
@@ -145,28 +135,6 @@ static void OnScrollComplete( const Vector3& position )
   gOnScrollCompleteCalled = true;
 }
 
-/**
- * Invoked when scrolling clamped.
- *
- * @param[in] event The position/scale/rotation axes that were clamped.
- */
-static void OnScrollClamped( const ScrollView::ClampEvent& event )
-{
-  gOnScrollClampedCalled = true;
-  gLastClampPosition = event.position;
-}
-
-/**
- * Invoked when a snap or flick started.
- *
- * @param[in] event The type of snap and the target position/scale/rotation.
- */
-static void OnSnapStart( const ScrollView::SnapEvent& event )
-{
-  gOnSnapStartCalled = true;
-  gLastSnapType = event.type;
-}
-
 ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
 {
   ScrollView scrollView = ScrollView::New();
@@ -263,25 +231,6 @@ Actor AddActorToPage(Actor page, float x, float y, float cols, float rows)
 } // unnamed namespace
 
 
-int UtcDaliScrollViewCustomEffectSetup(void)
-{
-  tet_infoline(" UtcDaliScrollViewCustomEffectSetup");
-
-  ScrollViewCustomEffect effect;
-
-  DALI_TEST_CHECK( !effect );
-
-  BaseHandle handle = ScrollViewCustomEffect::New();
-
-  DALI_TEST_CHECK( handle );
-
-  effect = ScrollViewCustomEffect::DownCast(handle);
-
-  DALI_TEST_CHECK( effect );
-
-  END_TEST;
-}
-
 int UtcDaliScrollViewCubeEffectSetup(void)
 {
   tet_infoline(" UtcDaliScrollViewCubeEffectSetup");
@@ -339,24 +288,6 @@ int UtcDaliScrollViewSlideEffectSetup(void)
   END_TEST;
 }
 
-int UtcDaliScrollViewTwistEffectSetup(void)
-{
-  tet_infoline(" UtcDaliScrollViewTwistEffectSetup");
-
-  ScrollViewTwistEffect effect;
-
-  DALI_TEST_CHECK( !effect );
-
-  BaseHandle handle = ScrollViewTwistEffect::New();
-
-  DALI_TEST_CHECK( handle );
-
-  effect = ScrollViewTwistEffect::DownCast(handle);
-
-  DALI_TEST_CHECK( effect );
-  END_TEST;
-}
-
 int UtcDaliScrollViewCubeEffectTest(void)
 {
   ToolkitTestApplication application;
@@ -471,213 +402,3 @@ int UtcDaliScrollViewSlideEffectTest(void)
   CleanupTest();
   END_TEST;
 }
-
-int UtcDaliScrollViewTwistEffectTest(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliScrollViewTwistEffectTest");
-
-  Vector2 size = Stage::GetCurrent().GetSize();
-
-  ScrollView scrollView = SetupTestScrollView(1, 3, size);
-  Actor testPage = gPages[1];
-  Wait(application, 500);
-
-  ScrollViewTwistEffect effect = ScrollViewTwistEffect::New();
-  float shrinkDist = 0.2f;
-  effect.SetMinimumDistanceForShrink(shrinkDist);
-  DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0);
-  effect.EnableEffect(true);
-  scrollView.ApplyEffect(effect);
-
-  Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
-  Wait(application);
-  Vector3 actorPrePosition = actor.GetCurrentPosition();
-
-  effect.ApplyToActor( actor,
-      true,
-      Vector2(Math::PI_2, Math::PI_2),
-      0.0f);
-
-  scrollView.ScrollTo(1);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  // test that the first page has reached centre of screen
-  Vector3 actorPostPosition = actor.GetCurrentPosition();
-  // just check the actor has moved
-  DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
-  CleanupTest();
-  END_TEST;
-}
-
-int UtcDaliScrollViewCustomEffectTest(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliScrollViewCustomEffectTest");
-
-  Vector2 size = Stage::GetCurrent().GetSize();
-  Vector3 pageSize(size.x, size.y, 0.0f);
-
-  ScrollView scrollView = SetupTestScrollView(1, 3, size);
-  Actor testPage = gPages[1];
-  Wait(application, 500);
-  Vector3 pageStartPos, pagePos;
-  pageStartPos = pagePos = testPage.GetCurrentPosition();
-  //scrollView.RemoveConstraintsFromChildren();
-
-  ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel));
-
-  for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
-  {
-    Actor page = *pageIter;
-    page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
-    effect.ApplyToPage(page, pageSize);
-  }
-  Wait(application);
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  scrollView.ScrollTo(1);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  // test that the first page has reached centre of screen
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  // scroll back to page 0
-  scrollView.ScrollTo(0);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  scrollView.RemoveEffect(effect);
-
-  effect = ScrollViewCustomEffect::New();
-  effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f));
-  effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f), Vector3(20.0f, 20.0f, -5.0f));
-  effect.SetPageTranslationIn(Vector3(20.0f, 20.0f, 5.0f));
-  effect.SetPageTranslationOut(Vector3(20.0f, 20.0f, -5.0f));
-  effect.SetPageTranslation(Vector3(20.0f, 0.0f, 0.0f));
-  effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
-  effect.SetPageSpacing(Vector2(20.0f, 20.0f));
-  scrollView.ApplyEffect(effect);
-
-  for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
-  {
-    Actor page = *pageIter;
-    page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
-    effect.ApplyToPage(page, pageSize);
-  }
-  Wait(application);
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  scrollView.ScrollTo(1);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  // test that the first page has reached centre of screen
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  // scroll back to page 0
-  scrollView.ScrollTo(0);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  scrollView.RemoveEffect(effect);
-  effect = ScrollViewCustomEffect::New();
-  effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
-  effect.SetSwingAnchor(AnchorPoint::CENTER_LEFT);
-  effect.SetPageTranslation(Vector3(size.x, size.y, 0));
-  effect.SetOpacityThreshold(0.66f);
-  scrollView.ApplyEffect(effect);
-
-  for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
-  {
-    Actor page = *pageIter;
-    page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
-    effect.ApplyToPage(page, pageSize);
-  }
-  Wait(application);
-
-  scrollView.ScrollTo(1);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  // test that the first page has reached centre of screen
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
-  // scroll back to page 0
-  scrollView.ScrollTo(0);
-  while(!gOnScrollCompleteCalled)
-  {
-    Wait(application);
-  }
-  ResetScrollCallbackResults();
-  pagePos = testPage.GetCurrentPosition();
-  DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-  scrollView.RemoveEffect(effect);
-
-
-  effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear);
-  effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
-  effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear);
-  effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear);
-  effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS);
-  effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f));
-  effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
-  effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS);
-  effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS);
-  effect.SetGlobalPageRotationOrigin(Vector3::ZERO);
-  effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO);
-  effect.SetGlobalPageRotationOriginIn(Vector3::ZERO);
-  effect.SetGlobalPageRotationOriginOut(Vector3::ZERO);
-  effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
-  effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
-  effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS);
-  effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS);
-  effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear);
-  effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
-  effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear);
-  effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear);
-  effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT);
-  effect.SetSwingAnchorIn(AnchorPoint::CENTER);
-  effect.SetSwingAnchorOut(AnchorPoint::CENTER);
-  effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear);
-  effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
-  effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear);
-  effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear);
-  effect.SetOpacityThreshold(0.5f);
-  effect.SetOpacityThreshold(0.5f, 0.5f);
-  effect.SetOpacityThresholdIn(0.5f);
-  effect.SetOpacityThresholdOut(0.5f);
-  effect.SetOpacityAlphaFunction(AlphaFunctions::Linear);
-  effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
-  effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear);
-  effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear);
-  CleanupTest();
-  END_TEST;
-}