+ // compare how much the Y position has deviated for normal and autolock.
+ const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
+ const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
+
+ // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
+ DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
+
+ scrollView.SetAxisAutoLock(false);
+ DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewAxisAutoLockGradient(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLockGradient");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetAxisAutoLockGradient(0.5f);
+ DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
+ scrollView.SetAxisAutoLockGradient(1.0f);
+ DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewConstraints(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewConstraints");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, 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);
+
+ // Add an Actor to ScrollView,
+ // Apply TestSumConstraint to ScrollView's children (includes this Actor)
+ gConstraintResult = Vector3::ZERO;
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetProperty(Actor::Property::POSITION, TEST_ACTOR_POSITION);
+ Wait(application);
+
+ 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);
+
+ DALI_TEST_EQUALS(gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION);
+
+ gConstraintResult = Vector3::ZERO;
+ scrollView.RemoveConstraintsFromChildren();
+ Wait(application);
+
+ DALI_TEST_EQUALS(gConstraintResult, Vector3::ZERO, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewBind(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewBind");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, 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);
+
+ // Add an Actor to ScrollView,
+ // Apply TestSumConstraint to ScrollView's children (includes this Actor)
+
+ gConstraintResult = Vector3::ZERO;
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetProperty(Actor::Property::POSITION, TEST_ACTOR_POSITION);
+ Wait(application);
+
+ // apply this constraint to scrollview
+ 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);
+ // Defaulty Bound.
+ DALI_TEST_EQUALS(gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION);
+
+ // UnBind
+ gConstraintResult = Vector3::ZERO;
+ scrollView.UnbindActor(a);
+ Wait(application);
+ DALI_TEST_EQUALS(gConstraintResult, Vector3::ZERO, TEST_LOCATION);
+
+ // Bind
+ gConstraintResult = Vector3::ZERO;
+ scrollView.BindActor(a);
+ Wait(application);
+ DALI_TEST_EQUALS(gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewOvershoot(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewOvershoot");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetOvershootEnabled(true);
+
+ uint32_t time = 0;
+ Vector2 overshootSize = Vector2(100.0f, 100.0f);
+ scrollView.SetProperty(Scrollable::Property::OVERSHOOT_SIZE, overshootSize);
+ DALI_TEST_EQUALS(scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION);
+
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, 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.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
+ time += Wait(application);
+
+ // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
+ Vector2 currentPos = Vector2(100.0f, 100.0f);
+ currentPos = PerformGestureSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, time, false);
+ float overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ float overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ Vector2 positionValue = scrollView.GetCurrentProperty<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, Vector2::ZERO, TEST_LOCATION);
+
+ float timeToReachOrigin;
+
+ // Now release touch. Overshoot should snap back to zero.
+ TestEndPan(application, currentPos, time);
+
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ 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);
+
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
+ // Now release touch. Overshoot should snap back to zero.
+ TestEndPan(application, currentPos, time);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ 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);
+
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
+ // Now release touch. Overshoot should snap back to zero.
+ TestEndPan(application, currentPos, time);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ 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);
+ scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
+
+ currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
+ // Now release touch. Overshoot should snap back to zero.
+ TestEndPan(application, currentPos, time);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ 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;
+}
+
+int UtcDaliToolkitScrollViewSnapAlphaFunction(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSnapAlphaFunction");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ 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;
+}
+
+int UtcDaliToolkitScrollViewSnapDuration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSnapDuration");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetScrollSnapDuration(1.0f);
+ DALI_TEST_EQUALS(scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION);
+ scrollView.SetScrollSnapDuration(0.5f);
+ DALI_TEST_EQUALS(scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION);
+
+ scrollView.SetScrollFlickDuration(2.0f);
+ DALI_TEST_EQUALS(scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION);
+ scrollView.SetScrollFlickDuration(1.5f);
+ DALI_TEST_EQUALS(scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSnapStartedSignalP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSnapStartedSignalP");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, 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.SnapStartedSignal().Connect(&OnSnapStart);
+
+ scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
+ uint32_t time = 0;
+ time += Wait(application);
+
+ // First try a snap.
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, time, true);
+
+ DALI_TEST_CHECK(gOnSnapStartCalled);
+ DALI_TEST_CHECK(gLastSnapType == Toolkit::SNAP);
+
+ // Second try a swipe.
+ PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, time, true);
+
+ DALI_TEST_CHECK(gOnSnapStartCalled);
+ DALI_TEST_CHECK(gLastSnapType == Toolkit::FLICK);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewGetCurrentPageP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP");
+
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ RulerPtr rulerX = new FixedRuler(100.0f);
+ rulerX->SetDomain(RulerDomain(0.0f, 800.0f, true));
+ RulerPtr rulerY = new FixedRuler(100.0f);
+ rulerY->SetDomain(RulerDomain(0.0f, 400.0f, true));
+
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ scrollView.ScrollTo(15);
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS(static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION);
+
+ scrollView.ScrollTo(3);
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS(static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION);
+
+ scrollView.ScrollTo(9);
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS(static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetMaxOvershootP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetMaxOvershootP");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, 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);
+
+ // Set the max overshoot to be 50 pixels in both X axis and Y axis
+ scrollView.SetMaxOvershoot(50.0f, 50.0f);
+
+ scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
+ uint32_t time = 0;
+ time += Wait(application);
+
+ // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
+ Vector2 currentPos = PerformGestureSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 10, time, false);
+ float overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ float overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
+
+ time += Wait(application);
+ // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
+ for(int i = 0; i < 106; i++)
+ {
+ TestMovePan(application, currentPos, time);
+ currentPos += Vector2(1.0f, 1.0f);
+ time += Wait(application);
+ }
+
+ overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
+ // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
+ float correctOvershootValue = 0.508f; // This was measured and then set as the limit
+ DALI_TEST_EQUALS(overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION);
+
+ // Scroll page further in NW (-25,-25 pixels), then check that overshoot should be now 1.0. (don't release touch)
+ for(int i = 0; i < 25; i++)
+ {
+ TestMovePan(application, currentPos, time);
+ currentPos += Vector2(1.0f, 1.0f); // Move in this direction
+ time += Wait(application);
+ }
+
+ overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
+
+ // Change the max overshoot to be 250 pixels in both X axis and Y axis
+ scrollView.SetMaxOvershoot(250.0f, 250.0f);
+ time += Wait(application);
+
+ // Check that overshoot should be now around 0.8.
+ overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
+ DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
+
+ // Scroll page further in NW (-50,-50 pixels), then check that overshoot should be now 1.0. (don't release touch)
+ for(int i = 0; i < 50; i++)
+ {
+ TestMovePan(application, currentPos, time);
+ currentPos += Vector2(1.0f, 1.0f); // Move in this direction
+ time += Wait(application);
+ }
+
+ overshootXValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_X);
+ overshootYValue = scrollView.GetCurrentProperty<float>(ScrollView::Property::OVERSHOOT_Y);
+ DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetScrollingDirectionP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetScrollingDirectionP");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ Vector2 START_POSITION = Vector2(10.0f, 10.0f);
+
+ scrollView.ScrollTo(START_POSITION, 0.0f);
+ uint32_t time = 0;
+ time += Wait(application);
+
+ // Try a vertical swipe.
+ // PerformGestureSwipe not used as a different initial direction was required
+
+ Vector2 pos(START_POSITION + Vector2(0.0f, 15.0f));
+ TestStartPan(application, START_POSITION, pos, time);
+ time += Wait(application);
+ for(int i = 0; i < 45; i++)
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan(application, pos, time);
+ time += Wait(application);
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan(application, pos, time);
+ time += Wait(application);
+
+ // Take into account resampling done when prediction is off.
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION);
+
+ scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
+
+ scrollView.ScrollTo(START_POSITION, 0.0f);
+ time += Wait(application);
+
+ // Try a vertical swipe.
+ // PerformGestureSwipe not used as a different initial direction was required
+ pos = (START_POSITION + Vector2(0.0f, 15.0f));
+ TestStartPan(application, START_POSITION, pos, time);
+ time += Wait(application);
+ for(int i = 0; i < 45; i++)
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan(application, pos, time);
+ time += Wait(application);
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan(application, pos, time);
+ time += Wait(application);
+
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION);
+
+ scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
+
+ scrollView.ScrollTo(START_POSITION, 0.0f);
+
+ time += Wait(application);
+
+ // Try a vertical swipe.
+ // PerformGestureSwipe not used as a different initial direction was required
+ pos = (START_POSITION + Vector2(0.0f, 15.0f));
+ TestStartPan(application, START_POSITION, pos, time);
+ time += Wait(application);
+ for(int i = 0; i < 45; i++)
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan(application, pos, time);
+ time += Wait(application);
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan(application, pos, time);
+ time += Wait(application);
+
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewRemoveScrollingDirectionP");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ Vector2 stageSize = application.GetScene().GetSize();
+ scrollView.SetProperty(Actor::Property::SIZE, stageSize);
+ scrollView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ scrollView.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ Vector2 START_POSITION = Vector2(10.0f, 10.0f);
+ uint32_t time = 0;
+
+ scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
+
+ scrollView.ScrollTo(START_POSITION, 0.0f);
+
+ time += Wait(application);
+
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION);
+
+ // Try a vertical swipe.
+ // PerformGestureSwipe not used as a different initial direction was required
+ Vector2 pos(START_POSITION + Vector2(0.0f, 15.0f));
+ TestStartPan(application, START_POSITION, pos, time);
+ time += Wait(application);
+ for(int i = 0; i < 45; i++)
+ {
+ pos += Vector2(0.0f, 1.0f);
+ TestMovePan(application, pos, time);
+ time += Wait(application);
+ }
+ pos += Vector2(0.0f, 1.0f);
+ TestEndPan(application, pos, time);
+ time += Wait(application);
+
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION);
+
+ scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
+ // When the horizontal direction is removed, there are no directions set and therefore all will work
+ scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_HORIZONTAL);
+
+ time += Wait(application);
+ // Try a vertical swipe.
+ Vector2 pos2(pos + Vector2(0.0f, 15.0f));
+ TestStartPan(application, pos, pos2, time);
+ time += Wait(application);
+ for(int i = 0; i < 45; i++)
+ {
+ pos2 += Vector2(0.0f, 1.0f);
+ TestMovePan(application, pos2, time);
+ time += Wait(application);
+ }
+ pos2 += Vector2(0.0f, 1.0f);
+ TestEndPan(application, pos2, time);
+
+ // The previous scroll should not have had any effect
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetRulerXP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP");
+
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+ RulerPtr rulerX = new FixedRuler(100.0f);
+ rulerX->SetDomain(RulerDomain(0.0f, 800.0f, true));
+
+ scrollView.SetRulerX(rulerX);
+
+ scrollView.ScrollTo(1, 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION);
+
+ RulerPtr newRulerX = new FixedRuler(200.0f);
+ newRulerX->SetDomain(RulerDomain(0.0f, 800.0f, true));
+
+ scrollView.SetRulerX(newRulerX);
+
+ scrollView.ScrollTo(1, 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 0.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetRulerYP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP");
+
+ ScrollView scrollView = ScrollView::New();
+ application.GetScene().Add(scrollView);
+
+ RulerPtr rulerY = new FixedRuler(200.0f);
+ rulerY->SetDomain(RulerDomain(0.0f, 400.0f, true));
+
+ scrollView.SetRulerY(rulerY);
+
+ scrollView.ScrollTo(Vector2(0.0f, 350.0f), 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 350.0f), TEST_LOCATION);
+
+ RulerPtr newRulerY = new FixedRuler(100.0f);
+ newRulerY->SetDomain(RulerDomain(0.0f, 200.0f, true));
+ scrollView.SetRulerY(newRulerY);
+
+ scrollView.ScrollTo(Vector2(0.0f, 350.0f), 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS(scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 200.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP");
+
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetMinimumSpeedForFlick(25.0f);
+ DALI_TEST_EQUALS(scrollView.GetMinimumSpeedForFlick(), 25.0f, TEST_LOCATION);
+ scrollView.SetMinimumSpeedForFlick(60.0f);
+ DALI_TEST_EQUALS(scrollView.GetMinimumSpeedForFlick(), 60.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetMinimumDistanceForFlick");
+
+ ScrollView scrollView = ScrollView::New();
+
+ scrollView.SetMinimumDistanceForFlick(Vector2(30.0f, 15.0f));
+ DALI_TEST_EQUALS(scrollView.GetMinimumDistanceForFlick(), Vector2(30.0f, 15.0f), TEST_LOCATION);
+ scrollView.SetMinimumDistanceForFlick(Vector2(60.0f, 30.0f));
+ DALI_TEST_EQUALS(scrollView.GetMinimumDistanceForFlick(), Vector2(60.0f, 30.0f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
+ DALI_TEST_EQUALS(scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION);
+ scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
+ DALI_TEST_EQUALS(scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewApplyEffectP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewApplyEffectP");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Create two scroll view effects
+ Dali::Path path = Dali::Path::New();
+ ScrollViewEffect effect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 0.0f, 0.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(100.0f, 100.0f, 0.0f), 2);
+ ScrollViewEffect newEffect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 1.0f, 1.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(200.0f, 150.0f, 0.0f), 5);
+
+ // Apply both effects
+ scrollView.ApplyEffect(effect);
+ scrollView.ApplyEffect(newEffect);
+
+ DALI_TEST_CHECK(true);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewApplyEffectN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewApplyEffectN");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Create two scroll view effects
+ Dali::Path path = Dali::Path::New();
+ ScrollViewEffect effect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 0.0f, 0.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(100.0f, 100.0f, 0.0f), 2);
+ ScrollViewEffect newEffect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 1.0f, 1.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(200.0f, 150.0f, 0.0f), 5);
+
+ // Apply both effects
+ scrollView.ApplyEffect(effect);
+ scrollView.ApplyEffect(newEffect);
+
+ // Attempt to apply the same effect again
+ try
+ {
+ scrollView.ApplyEffect(newEffect);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& e)
+ {
+ DALI_TEST_ASSERT(e, "!effectAlreadyExistsInScrollView", TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRemoveEffectP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectP");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Create two scroll view effects
+ Dali::Path path = Dali::Path::New();
+ ScrollViewEffect effect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 0.0f, 0.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(100.0f, 100.0f, 0.0f), 2);
+ ScrollViewEffect newEffect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 1.0f, 1.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(200.0f, 150.0f, 0.0f), 5);
+
+ // Apply both effects
+ scrollView.ApplyEffect(effect);
+ scrollView.ApplyEffect(newEffect);
+
+ // Remove both effects
+ scrollView.RemoveEffect(effect);
+ scrollView.RemoveEffect(newEffect);
+
+ DALI_TEST_CHECK(true);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRemoveEffectN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectN");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Create two scroll view effects
+ Dali::Path path = Dali::Path::New();
+ ScrollViewEffect effect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 0.0f, 0.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(100.0f, 100.0f, 0.0f), 2);
+ ScrollViewEffect newEffect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 1.0f, 1.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(200.0f, 150.0f, 0.0f), 5);
+
+ // Apply the first effect
+ scrollView.ApplyEffect(effect);
+
+ // Attempt to remove the second effect which has not been applied to scroll view
+ try
+ {
+ scrollView.RemoveEffect(newEffect);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& e)
+ {
+ DALI_TEST_ASSERT(e, "effectExistedInScrollView", TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRemoveAllEffectsP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsP");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Create two scroll view effects
+ Dali::Path path = Dali::Path::New();
+ ScrollViewEffect effect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 0.0f, 0.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(100.0f, 100.0f, 0.0f), 2);
+ ScrollViewEffect newEffect = ScrollViewPagePathEffect::New(path, Vector3(-1.0f, 1.0f, 1.0f), Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(200.0f, 150.0f, 0.0f), 5);
+
+ // Apply both effects
+ scrollView.ApplyEffect(effect);
+ scrollView.ApplyEffect(newEffect);
+
+ // Attempt to apply the same first effect again
+ try
+ {
+ scrollView.ApplyEffect(effect);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& e)
+ {
+ DALI_TEST_ASSERT(e, "!effectAlreadyExistsInScrollView", TEST_LOCATION);
+ }
+
+ // Remove both effects
+ scrollView.RemoveAllEffects();
+
+ // Apply both effects again
+ scrollView.ApplyEffect(effect);
+ scrollView.ApplyEffect(newEffect);
+
+ DALI_TEST_CHECK(true);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRemoveAllEffectsN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsN");
+
+ // Create a ScrollView
+ ScrollView scrollView = ScrollView::New();
+
+ // Remove effects when there is no effect applied previously
+ scrollView.RemoveAllEffects();
+
+ DALI_TEST_CHECK(true);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetOvershootEnabledP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEnabledP");
+
+ ScrollView scrollView = ScrollView::New();
+
+ scrollView.SetOvershootEnabled(true);
+ DALI_TEST_CHECK(scrollView.IsOvershootEnabled());
+
+ scrollView.SetOvershootEnabled(false);
+ DALI_TEST_CHECK(!scrollView.IsOvershootEnabled());
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetOvershootEffectColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEffectColorP");
+
+ ScrollView scrollView = ScrollView::New();
+
+ scrollView.SetOvershootEffectColor(Dali::Color::RED);
+ DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::RED, TEST_LOCATION);
+
+ scrollView.SetOvershootEffectColor(Dali::Color::YELLOW);
+ DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::YELLOW, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP");
+
+ ScrollView scrollView = ScrollView::New();
+
+ scrollView.SetOvershootAnimationSpeed(55.0f);
+ DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 55.0f, TEST_LOCATION);
+
+ scrollView.SetOvershootAnimationSpeed(120.0f);
+ DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 120.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewGetSet(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewGetSet");
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetMaxFlickSpeed(0.5f);
+ DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ scrollView.SetFrictionCoefficient(0.6f);
+ DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ scrollView.SetFlickSpeedCoefficient(0.7f);
+ DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRulerDomainConstructorP(void)
+{
+ ToolkitTestApplication application;
+
+ RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
+ DALI_TEST_EQUALS(domainX.min, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(domainX.max, 200.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(domainX.enabled, true, TEST_LOCATION);
+
+ RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
+ DALI_TEST_EQUALS(domainY.min, 100.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(domainY.max, 500.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(domainY.enabled, false, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRulerDomainGetSizeP(void)
+{
+ ToolkitTestApplication application;
+
+ RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
+ DALI_TEST_EQUALS(domainX.GetSize(), 200.0f, TEST_LOCATION);
+
+ RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
+ DALI_TEST_EQUALS(domainY.GetSize(), 400.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRulerDomainClampP(void)
+{
+ ToolkitTestApplication application;
+
+ RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
+
+ float value = domainX.Clamp(50.0f, 100.0f, 1.0f);
+ DALI_TEST_EQUALS(value, 50.0f, TEST_LOCATION);
+
+ value = domainX.Clamp(300.0f, 20.0f, 1.0f);
+ DALI_TEST_EQUALS(value, 180.0f, TEST_LOCATION);
+
+ value = domainX.Clamp(300.0f, 20.0f, 0.5f);
+ DALI_TEST_EQUALS(value, 80.0f, TEST_LOCATION);
+
+ value = domainX.Clamp(250.0f, 200.0f, 2.0f);
+ DALI_TEST_EQUALS(value, 200.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void)
+{
+ ToolkitTestApplication application;
+
+ RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
+
+ ClampState clamped;
+ float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped);
+ DALI_TEST_EQUALS(value, 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(clamped, Dali::Toolkit::NOT_CLAMPED, TEST_LOCATION);
+
+ value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped);
+ DALI_TEST_EQUALS(value, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(clamped, Dali::Toolkit::CLAMPED_TO_MIN, TEST_LOCATION);