const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side"
const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side"
const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)"
-const Vector3 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f, 0.0f); ///< Scroll start position for the Clamping tests.
+const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f); ///< Scroll start position for the Clamping tests.
const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons.
-const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
-const Vector3 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f, 0.0f); ///< Scroll start position for the Overshoot tests.
-const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
-const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
+const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); ///< Default overshoot snapping animation time.
+const float DEFAULT_MAX_OVERSHOOT(100.0f); ///< Default maximum allowed overshoot in pixels
+
+const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
+const Vector2 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f); ///< Scroll start position for the Overshoot tests.
+const float SCROLL_ANIMATION_DURATION(0.33f); ///< Duration of scroll animation in Overshoot tests (i.e. 100 pixels of overshoot in the speed of 500 pixels per 100 frames, 100/(500/(100/60)) = 0.33)
+const Vector2 SNAP_POSITION_WITH_DECELERATED_VELOCITY(74.0f, 74.0f); ///< the snap position for Overshoot tests with the decelerated velocity (i.e. Decelerated from 500 pixels per 100 frames).
+const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
+const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
-const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
+const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
// Generate a PanGestureEvent to send to Core
*
* @param[in] position The current scroll position.
*/
-static void OnScrollStart( const Vector3& position )
+static void OnScrollStart( const Vector2& position )
{
gOnScrollStartCalled = true;
}
*
* @param[in] position The current scroll position.
*/
-static void OnScrollUpdate( const Vector3& position )
+static void OnScrollUpdate( const Vector2& position )
{
gOnScrollUpdateCalled = true;
}
*
* @param[in] position The current scroll position.
*/
-static void OnScrollComplete( const Vector3& position )
+static void OnScrollComplete( const Vector2& position )
{
gOnScrollCompleteCalled = true;
}
/**
* @param[in] current The current base value
- * @param[in] property The property to be added to current.
- * @return The new current Vector.
- */
- Vector3 operator()(const Vector3& current)
- {
- gConstraintResult = current + mOffset;
- return gConstraintResult;
- }
-
- /**
- * @param[in] current The current base value
- * @param[in] property The property to be added to current.
+ * @param[in] inputs Contains the property to be added to current.
* @return The new current Vector.
*/
- Vector3 operator()(const Vector3& current,
- const PropertyInput& property)
+ void operator()( Vector3& current, const PropertyInputContainer& inputs )
{
- gConstraintResult = current + property.GetVector3() + mOffset;
- return gConstraintResult;
+ gConstraintResult = current + Vector3(inputs[0]->GetVector2()) + mOffset;
+ current = gConstraintResult;
}
Vector3 mOffset;
*/
static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
{
- Property::Index overshootPropertyX = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME);
- Property::Index overshootPropertyY = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME);
-
int timeToReachOrigin = -1;
for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
{
- float overshootXValue = scrollView.GetProperty<float>(overshootPropertyX);
- float overshootYValue = scrollView.GetProperty<float>(overshootPropertyY);
+ float overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ float overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
if(overshootXValue == 0.0f && overshootYValue == 0.0f)
{
break;
ScrollView scrollView = ScrollView::New();
Stage::GetCurrent().Add( scrollView );
- const Vector3 target = Vector3(100.0f, 200.0f, 0.0f);
- const Vector3 target2 = Vector3(300.0f, 100.0f, 0.0f);
+ const Vector2 target = Vector2(100.0f, 200.0f);
+ const Vector2 target2 = Vector2(300.0f, 100.0f);
scrollView.ScrollTo( target, 0.0f );
Wait(application);
scrollView.ScrollTo( 1, 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
scrollView.ScrollTo( 5, 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(500.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(500.0f, 0.0f), TEST_LOCATION );
scrollView.ScrollTo( 10, 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(200.0f, 100.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 100.0f), TEST_LOCATION );
scrollView.ScrollTo( 15, 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(700.0f, 100.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(700.0f, 100.0f), TEST_LOCATION );
DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
scrollView.ScrollTo( 3 );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(300.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(300.0f, 0.0f), TEST_LOCATION );
DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
scrollView.ScrollTo( 9 );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 100.0f), TEST_LOCATION );
DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
// Apply DefaultRulers instead and see what happens.
// This time should always scroll to origin (0.0f, 0.0f)
scrollView.ScrollTo( 1, 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
Wait(application);
scrollView.ScrollTo(actorA, 0.0f);
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
Wait(application);
scrollView.ScrollTo(actorB, 0.0f);
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
scrollView.ScrollTo(actorA);
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
scrollView.ScrollTo(actorB);
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
END_TEST;
}
scrollView.SetRulerX( rulerX );
scrollView.SetRulerY( rulerY );
- scrollView.ScrollTo( Vector3(120.0f, 190.0f, 0.0f), 0.0f );
+ scrollView.ScrollTo( Vector2(120.0f, 190.0f), 0.0f );
Wait(application);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(120.0f, 190.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(120.0f, 190.0f), TEST_LOCATION );
scrollView.ScrollToSnapPoint();
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 200.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 200.0f), TEST_LOCATION );
END_TEST;
}
scrollView.SetRulerY(rulerY);
scrollView.SetWrapMode(false);
- scrollView.ScrollTo(Vector3(225.0f, 125.0f, 0.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
+ scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
Wait(application);
DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
scrollView.SetWrapMode(true);
b.SetPosition(bPosition);
// Goto a random position, and execute snap (should not move)
- Vector3 targetScroll = Vector3(500.0f, 500.0f, 0.0f);
+ Vector2 targetScroll = Vector2(500.0f, 500.0f);
scrollView.ScrollTo(targetScroll, 0.0f);
Wait(application);
scrollView.ScrollToSnapPoint();
scrollView.SetActorAutoSnap(true);
scrollView.ScrollToSnapPoint();
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition.GetVectorXY(), TEST_LOCATION );
- scrollView.ScrollTo(Vector3(0.0f, 0.0f, 0.0f), 0.0f);
+ scrollView.ScrollTo(Vector2(0.0f, 0.0f), 0.0f);
Wait(application);
scrollView.ScrollToSnapPoint();
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition.GetVectorXY(), TEST_LOCATION );
END_TEST;
}
scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
- scrollView.ScrollTo( Vector3(100.0f, 100.0f, 0.0f) );
+ scrollView.ScrollTo( Vector2(100.0f, 100.0f) );
Wait(application, RENDER_DELAY_SCROLL);
DALI_TEST_CHECK(gOnScrollStartCalled);
END_TEST;
}
-int UtcDaliScrollViewTouchesRequired(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewTouchesRequired");
-
- // Set up a scrollView...
- ScrollView scrollView = ScrollView::New();
- Stage::GetCurrent().Add( scrollView );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- scrollView.SetSize(stageSize);
- scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
- scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-
- // Position rulers.
- RulerPtr rulerX = new DefaultRuler();
- RulerPtr rulerY = new DefaultRuler();
- rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
- rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
- scrollView.SetRulerX(rulerX);
- scrollView.SetRulerY(rulerY);
- scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
- scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
- scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
- scrollView.SnapStartedSignal().Connect( &OnSnapStart );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // First try touches required being a minimum and maximum of 2.
- scrollView.SetTouchesRequiredForPanning(2, 2, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
-
- DALI_TEST_CHECK( !gOnScrollStartCalled );
- DALI_TEST_CHECK( !gOnScrollUpdateCalled );
- DALI_TEST_CHECK( !gOnScrollCompleteCalled );
- DALI_TEST_CHECK( !gOnSnapStartCalled );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // Second try touches required being a minimum and maximum of 1.
- scrollView.SetTouchesRequiredForPanning(1, 1, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT * 0.1f, CLAMP_GESTURE_FRAMES * 0.1f, true);
-
- DALI_TEST_CHECK( gOnScrollStartCalled );
- DALI_TEST_CHECK( gOnScrollUpdateCalled );
- DALI_TEST_CHECK( gOnScrollCompleteCalled );
- DALI_TEST_CHECK( gOnSnapStartCalled );
- END_TEST;
-}
-
int UtcDaliScrollViewAxisAutoLock(void)
{
ToolkitTestApplication application;
scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
// Normal
- scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little.
+ scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
Wait(application);
- Vector3 startPosition = scrollView.GetCurrentScrollPosition();
+ Vector2 startPosition = scrollView.GetCurrentScrollPosition();
PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
- const Vector3 positionAfterNormal = scrollView.GetCurrentScrollPosition();
+ const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
// Autolock
scrollView.SetAxisAutoLock(true);
DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
- scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little.
+ scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
Wait(application);
PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
- const Vector3 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
+ const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
// compare how much the Y position has deviated for normal and autolock.
const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
a.SetPosition( TEST_ACTOR_POSITION );
Wait(application);
- Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
- Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
- Source(scrollView, scrollPositionProperty),
- TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+ Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+ constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
constraint.SetRemoveAction(Constraint::Discard);
scrollView.ApplyConstraintToChildren(constraint);
Wait(application);
a.SetPosition( TEST_ACTOR_POSITION );
Wait(application);
- Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
// apply this constraint to scrollview
- Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
- Source(scrollView, scrollPositionProperty),
- TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
-
+ Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+ constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
constraint.SetRemoveAction(Constraint::Discard);
scrollView.ApplyConstraintToChildren(constraint);
// 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
Vector2 currentPos = Vector2(100.0f, 100.0f);
currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
- Property::Index overshootXProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME);
- Property::Index overshootYProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME);
- Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
- float overshootXValue = scrollView.GetProperty<float>(overshootXProperty);
- float overshootYValue = scrollView.GetProperty<float>(overshootYProperty);
- Vector3 positionValue = scrollView.GetProperty<Vector3>(scrollPositionProperty);
+ float overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ float overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ Vector2 positionValue = scrollView.GetProperty<Vector2>(ScrollView::Property::SCROLL_POSITION);
DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(positionValue, Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION);
float timeToReachOrigin;
SendPan(application, Gesture::Finished, currentPos);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
- DALI_TEST_CHECK( (timeToReachOrigin > Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
- (timeToReachOrigin < Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+ float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
+ float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
+
+ DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
+ (timeToReachOrigin < maxTimeToReachOrigin) );
// 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
SendPan(application, Gesture::Finished, currentPos);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
- DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
- (timeToReachOrigin < TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+ minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
+ maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
+
+ DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
+ (timeToReachOrigin < maxTimeToReachOrigin) );
// 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
SendPan(application, Gesture::Finished, currentPos);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
- DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
- (timeToReachOrigin < TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+ minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
+ maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
+
+ DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
+ (timeToReachOrigin < maxTimeToReachOrigin) );
// 4. Repeat Scroll, but this time change overshoot function.
scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
SendPan(application, Gesture::Finished, currentPos);
timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
- DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
- (timeToReachOrigin < TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+ minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
+ maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
+
+ DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
+ (timeToReachOrigin < maxTimeToReachOrigin) );
END_TEST;
}
// Set up a scrollView...
ScrollView scrollView = ScrollView::New();
- scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseIn );
- DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseIn );
- scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseOut );
- DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseOut );
-
- scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::Bounce );
- DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::Bounce );
- scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::BounceBack );
- DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::BounceBack );
+ scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_IN );
+ DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_IN );
+ scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_OUT );
+ DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_OUT );
+
+ scrollView.SetScrollFlickAlphaFunction( AlphaFunction::BOUNCE );
+ DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction().GetBuiltinFunction() == AlphaFunction::BOUNCE );
+
END_TEST;
}