2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali/devel-api/object/handle-devel.h>
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/events/pan-gesture-event.h>
25 #include <dali-toolkit/devel-api/controls/scrollable/scroll-view/scroll-view-devel.h>
26 #include <dali-toolkit/devel-api/controls/scrollable/scroll-view/scroll-mode.h>
29 using namespace Toolkit;
31 void scroll_view_startup(void)
33 test_return_value = TET_UNDEF;
36 void scroll_view_cleanup(void)
38 test_return_value = TET_PASS;
43 static bool gObjectCreatedCallBackCalled;
45 static void TestCallback(BaseHandle handle)
47 gObjectCreatedCallBackCalled = true;
50 struct CallbackFunctor
52 CallbackFunctor(bool* callbackFlag)
53 : mCallbackFlag( callbackFlag )
59 *mCallbackFlag = true;
64 const int MILLISECONDS_PER_SECOND = 1000;
65 const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
66 const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
68 const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
70 // For Clamp Signal testing...
71 const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview
72 const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview
73 const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0; ///< FSM: "First check that scrollview isn't clamped"
74 const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side"
75 const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side"
76 const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)"
77 const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f); ///< Scroll start position for the Clamping tests.
78 const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
79 const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
80 const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
81 const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value)
82 const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
83 const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons.
85 const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); ///< Default overshoot snapping animation time.
86 const float DEFAULT_MAX_OVERSHOOT(100.0f); ///< Default maximum allowed overshoot in pixels
88 const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
89 const Vector2 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f); ///< Scroll start position for the Overshoot tests.
90 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)
91 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).
92 const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
93 const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
94 const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
95 const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
98 // Generate a PanGestureEvent to send to Core
99 Integration::PanGestureEvent GeneratePan(
100 Gesture::State state,
101 const Vector2& previousPosition,
102 const Vector2& currentPosition,
103 unsigned long timeDelta,
104 unsigned int numberOfTouches = 1)
106 Integration::PanGestureEvent pan(state);
108 pan.previousPosition = previousPosition;
109 pan.currentPosition = currentPosition;
110 pan.timeDelta = timeDelta;
111 pan.numberOfTouches = numberOfTouches;
117 * Helper to generate PanGestureEvent
119 * @param[in] application Application instance
120 * @param[in] state The Gesture State
121 * @param[in] pos The current position of touch.
123 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
127 if( (state == Gesture::Started) ||
128 (state == Gesture::Possible) )
134 application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
141 * Simulate time passed by.
143 * @note this will always process at least 1 frame (1/60 sec)
145 * @param application Test application instance
146 * @param duration Time to pass in milliseconds.
147 * @return The actual time passed in milliseconds
149 int Wait(ToolkitTestApplication& application, int duration = 0)
153 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
155 application.SendNotification();
156 application.Render(RENDER_FRAME_INTERVAL);
157 time += RENDER_FRAME_INTERVAL;
165 static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
166 static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
167 static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
168 static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
169 static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
170 static Vector3 gConstraintResult; ///< Result from constraint.
173 * Invoked when scrolling starts.
175 * @param[in] position The current scroll position.
177 static void OnScrollStart( const Vector2& position )
179 gOnScrollStartCalled = true;
183 * Invoked when scrolling updates (via dragging)
185 * @param[in] position The current scroll position.
187 static void OnScrollUpdate( const Vector2& position )
189 gOnScrollUpdateCalled = true;
193 * Invoked when scrolling finishes
195 * @param[in] position The current scroll position.
197 static void OnScrollComplete( const Vector2& position )
199 gOnScrollCompleteCalled = true;
203 * Invoked when a snap or flick started.
205 * @param[in] event The type of snap and the target position/scale/rotation.
207 static void OnSnapStart( const ScrollView::SnapEvent& event )
209 gOnSnapStartCalled = true;
210 gLastSnapType = event.type;
216 * Summation of current value, property, and offset.
218 * current' = current + mOffset + property;
220 struct TestSumConstraint
223 * @param[in] offset The offset to be added to current.
225 TestSumConstraint(const Vector3& offset)
231 * @param[in] current The current base value
232 * @param[in] inputs Contains the property to be added to current.
233 * @return The new current Vector.
235 void operator()( Vector3& current, const PropertyInputContainer& inputs )
237 gConstraintResult = current + Vector3(inputs[0]->GetVector2()) + mOffset;
238 current = gConstraintResult;
246 * @param[in] application The application instance
247 * @param[in] scrollView The scrollView instance
248 * @return The time taken for the overshoot to reach origin (zero)
250 static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
252 int timeToReachOrigin = -1;
253 for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
255 float overshootXValue = DevelHandle::GetCurrentProperty<float>( scrollView, ScrollView::Property::OVERSHOOT_X );
256 float overshootYValue = DevelHandle::GetCurrentProperty<float>( scrollView, ScrollView::Property::OVERSHOOT_Y );
257 if(overshootXValue == 0.0f && overshootYValue == 0.0f)
262 timeToReachOrigin += Wait(application);
265 return static_cast<float>(timeToReachOrigin) * 0.001f; // return in seconds not ms.
269 * y = 2x alpha function, which is clamped between 0.0f - 1.0f
271 * Animations should appear to finish (reach 100% point)
272 * at just half the time of a regular Linear AlphaFunction.
274 * @param[in] progress value (ranges from 0.0f - 1.0f)
275 * @return interpolation value (ranges from 0.0f - 1.0f)
277 float TestAlphaFunction(float progress)
279 return std::min( progress * 2.0f, 1.0f );
282 static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
284 gOnScrollStartCalled = false;
285 gOnScrollUpdateCalled = false;
286 gOnScrollCompleteCalled = false;
287 gOnSnapStartCalled = false;
289 // Now do a pan starting from (start) and heading (direction)
291 SendPan(application, Gesture::Possible, pos);
292 SendPan(application, Gesture::Started, pos);
295 for(int i = 0;i<frames;i++)
297 pos += direction; // Move in this direction
298 SendPan(application, Gesture::Continuing, pos);
304 pos += direction; // Move in this direction.
305 SendPan(application, Gesture::Finished, pos);
306 Wait(application, RENDER_DELAY_SCROLL);
313 } // unnamed namespace
316 int UtcDaliToolkitScrollViewConstructorP(void)
318 ToolkitTestApplication application;
320 ScrollView scrollView;
321 DALI_TEST_CHECK( !scrollView );
325 int UtcDaliToolkitScrollViewCopyConstructorP(void)
327 ToolkitTestApplication application;
329 ScrollView scrollView = ScrollView::New();
330 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
332 ScrollView copy( scrollView );
333 DALI_TEST_CHECK( copy );
334 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
338 int UtcDaliToolkitScrollViewAssignmentOperatorP(void)
340 ToolkitTestApplication application;
342 ScrollView scrollView = ScrollView::New();
343 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
345 ScrollView copy = scrollView;
346 DALI_TEST_CHECK( copy );
347 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
351 int UtcDaliScrollViewDestructorP(void)
353 ToolkitTestApplication application;
355 ScrollView* scrollView = new ScrollView();
358 DALI_TEST_CHECK( true );
362 int UtcDaliToolkitScrollViewNewP1(void)
364 ToolkitTestApplication application;
365 tet_infoline(" UtcDaliToolkitScrollViewNewP1");
367 ScrollView scrollView;
369 DALI_TEST_CHECK( !scrollView );
371 scrollView = ScrollView::New();
373 DALI_TEST_CHECK( scrollView );
375 ScrollView scrollView2(scrollView);
377 DALI_TEST_CHECK( scrollView2 == scrollView );
379 //Additional check to ensure object is created by checking if it's registered
380 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
381 DALI_TEST_CHECK( registry );
383 gObjectCreatedCallBackCalled = false;
384 registry.ObjectCreatedSignal().Connect( &TestCallback );
386 ScrollView scrollView = ScrollView::New();
388 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
392 int UtcDaliToolkitScrollViewNewP2(void)
394 ToolkitTestApplication application;
395 tet_infoline(" UtcDaliToolkitScrollViewNewP2 - create thru type registry");
397 ScrollView scrollView;
398 DALI_TEST_CHECK( !scrollView );
400 TypeRegistry typeRegistry = TypeRegistry::Get();
401 TypeInfo scrollViewType = typeRegistry.GetTypeInfo("ScrollView");
402 BaseHandle handle = scrollViewType.CreateInstance();
403 DALI_TEST_CHECK( handle );
405 scrollView = ScrollView::DownCast(handle);
406 DALI_TEST_CHECK( scrollView );
411 int UtcDaliToolkitScrollViewDownCastP(void)
413 ToolkitTestApplication application;
414 tet_infoline(" UtcDaliToolkitScrollViewDownCastP");
416 ScrollView scrollView = ScrollView::New();
417 BaseHandle handle(scrollView);
419 ScrollView newScrollView = ScrollView::DownCast( handle );
420 DALI_TEST_CHECK( scrollView );
421 DALI_TEST_CHECK( newScrollView == scrollView );
425 int UtcDaliToolkitScrollViewScrollToPositionP(void)
427 ToolkitTestApplication application;
428 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionP");
430 // Create the ScrollView actor
431 ScrollView scrollView = ScrollView::New();
432 Stage::GetCurrent().Add( scrollView );
434 const Vector2 target = Vector2(100.0f, 200.0f);
435 const Vector2 target2 = Vector2(300.0f, 100.0f);
437 scrollView.ScrollTo( target, 0.0f );
439 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
440 scrollView.ScrollTo( target2 );
441 Wait(application, RENDER_DELAY_SCROLL);
442 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
447 int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void)
449 ToolkitTestApplication application;
450 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP");
452 ScrollView scrollView = ScrollView::New();
453 Stage::GetCurrent().Add( scrollView );
454 RulerPtr rulerX = new FixedRuler( 100.0f );
455 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
456 RulerPtr rulerY = new FixedRuler( 100.0f );
457 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
459 scrollView.SetRulerX( rulerX );
460 scrollView.SetRulerY( rulerY );
462 scrollView.SetWrapMode(true);
464 Property::Value wrapMode = scrollView.GetProperty( Toolkit::ScrollView::Property::WRAP_ENABLED );
465 DALI_TEST_EQUALS( wrapMode.Get<bool>(), true, TEST_LOCATION );
467 const Vector2 target = Vector2(50.0f, 50.0f);
468 const Vector2 target2 = Vector2(150.0f, 150.0f);
470 scrollView.ScrollTo( target, 0.0f );
471 Wait(application, RENDER_DELAY_SCROLL);
472 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
474 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
475 Wait(application, RENDER_DELAY_SCROLL);
476 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
478 scrollView.ScrollTo( target, 0.0f );
479 Wait(application, RENDER_DELAY_SCROLL);
480 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
482 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
483 Wait(application, RENDER_DELAY_SCROLL);
484 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
489 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP(void)
491 ToolkitTestApplication application;
492 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP");
494 // Create the ScrollView actor
495 ScrollView scrollView = ScrollView::New();
496 Stage::GetCurrent().Add( scrollView );
498 const Vector2 target = Vector2(100.0f, 200.0f);
499 const Vector2 target2 = Vector2(300.0f, 100.0f);
501 scrollView.ScrollTo( target, 0.5f, TestAlphaFunction );
502 Wait(application, 250);
503 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
504 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
506 scrollView.ScrollTo( target2, 0.5f, AlphaFunction::LINEAR );
507 Wait(application, 250);
508 // Check that the scroll animation has not finished within half of the specified duration with the linear alpha function
509 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition() != target2 );
511 // Wait till the end of the specified duration
512 Wait(application, 250);
513 // Check that the scroll animation has finished
514 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
519 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(void)
521 ToolkitTestApplication application;
522 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP");
524 ScrollView scrollView = ScrollView::New();
525 Stage::GetCurrent().Add( scrollView );
526 RulerPtr rulerX = new FixedRuler( 100.0f );
527 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
528 RulerPtr rulerY = new FixedRuler( 100.0f );
529 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
531 scrollView.SetRulerX( rulerX );
532 scrollView.SetRulerY( rulerY );
534 scrollView.SetWrapMode(true);
536 const Vector2 target = Vector2(50.0f, 50.0f);
537 const Vector2 target2 = Vector2(150.0f, 150.0f);
539 scrollView.ScrollTo( target, 0.0f );
540 Wait(application, RENDER_DELAY_SCROLL);
541 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
543 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
544 Wait(application, RENDER_DELAY_SCROLL);
545 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
547 scrollView.ScrollTo( target, 0.0f );
548 Wait(application, RENDER_DELAY_SCROLL);
549 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
551 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
552 Wait(application, RENDER_DELAY_SCROLL);
553 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
555 scrollView.ScrollTo( target, 0.0f );
556 Wait(application, RENDER_DELAY_SCROLL);
557 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
559 scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
560 Wait(application, 125);
561 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
562 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
567 int UtcDaliToolkitScrollViewScrollToPageP(void)
569 ToolkitTestApplication application;
570 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageP");
572 ScrollView scrollView = ScrollView::New();
573 Stage::GetCurrent().Add( scrollView );
574 RulerPtr rulerX = new FixedRuler( 100.0f );
575 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
576 RulerPtr rulerY = new FixedRuler( 100.0f );
577 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
579 scrollView.SetRulerX( rulerX );
580 scrollView.SetRulerY( rulerY );
582 scrollView.ScrollTo( 1, 0.0f );
584 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
586 scrollView.ScrollTo( 5, 0.0f );
588 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(500.0f, 0.0f), TEST_LOCATION );
590 scrollView.ScrollTo( 10, 0.0f );
592 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 100.0f), TEST_LOCATION );
594 scrollView.ScrollTo( 15, 0.0f );
596 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(700.0f, 100.0f), TEST_LOCATION );
597 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
599 scrollView.ScrollTo( 3 );
600 Wait(application, RENDER_DELAY_SCROLL);
601 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(300.0f, 0.0f), TEST_LOCATION );
602 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
604 scrollView.ScrollTo( 9 );
605 Wait(application, RENDER_DELAY_SCROLL);
606 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 100.0f), TEST_LOCATION );
607 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
609 // Apply DefaultRulers instead and see what happens.
610 rulerX = new DefaultRuler();
611 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
612 rulerY = new DefaultRuler();
613 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
615 scrollView.SetRulerX( rulerX );
616 scrollView.SetRulerY( rulerY );
618 // This time should always scroll to origin (0.0f, 0.0f)
619 scrollView.ScrollTo( 1, 0.0f );
621 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
622 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
628 int UtcDaliToolkitScrollModeP1(void)
630 ToolkitTestApplication application;
631 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
633 // Set up a scrollView.
634 ScrollView scrollView = ScrollView::New();
636 // Do not rely on stage size for UTC tests.
637 Vector2 pageSize( 720.0f, 1280.0f );
638 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
639 scrollView.SetSize( pageSize );
640 scrollView.SetParentOrigin( ParentOrigin::CENTER );
641 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
642 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
645 Property::Map rulerMap;
646 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
647 rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, pageSize.width );
648 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, pageSize.width*3 );
649 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, false );
650 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
652 scrollView.SetWrapMode( false );
653 scrollView.SetScrollSensitive( true );
655 Stage::GetCurrent().Add( scrollView );
657 // Set up a gesture to perform.
658 Vector2 startPos( 50.0f, 0.0f );
659 Vector2 direction( -5.0f, 0.0f );
662 // Force starting position.
663 scrollView.ScrollTo( startPos, 0.0f );
666 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
667 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
669 // Confirm the final X coord has not moved more than one page from the start X position.
670 DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
672 // Finish the gesture and wait for the snap.
673 currentPos += direction;
674 SendPan( application, Gesture::Finished, currentPos );
675 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
676 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
678 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
679 DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
684 int UtcDaliToolkitScrollModeP2(void)
686 ToolkitTestApplication application;
687 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
689 // Set up a scrollView.
690 ScrollView scrollView = ScrollView::New();
692 // Do not rely on stage size for UTC tests.
693 Vector2 pageSize( 720.0f, 1280.0f );
694 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
695 scrollView.SetSize( pageSize );
696 scrollView.SetParentOrigin( ParentOrigin::CENTER );
697 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
698 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
701 Property::Map rulerMap;
702 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
703 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
704 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
705 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
706 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
708 scrollView.SetWrapMode( false );
709 scrollView.SetScrollSensitive( true );
711 Stage::GetCurrent().Add( scrollView );
713 // Set up a gesture to perform.
714 Vector2 startPos( 0.0f, 50.0f );
715 Vector2 direction( 0.0f, -6.0f );
718 // Force starting position.
719 scrollView.ScrollTo( startPos, 0.0f );
722 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
723 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
725 // Confirm the final X coord has not moved more than one page from the start X position.
726 DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
728 // Finish the gesture and wait for the snap.
729 currentPos += direction;
730 SendPan( application, Gesture::Finished, currentPos );
731 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
732 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
734 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
735 DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
740 int UtcDaliToolkitScrollModeP3(void)
742 ToolkitTestApplication application;
743 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
745 // Set up a scrollView.
746 ScrollView scrollView = ScrollView::New();
748 // Do not rely on stage size for UTC tests.
749 Vector2 pageSize( 720.0f, 1280.0f );
750 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
751 scrollView.SetSize( pageSize );
752 scrollView.SetParentOrigin( ParentOrigin::CENTER );
753 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
754 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
757 Property::Map rulerMap;
758 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
759 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
760 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
761 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
762 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
764 scrollView.SetWrapMode( false );
765 scrollView.SetScrollSensitive( true );
767 Stage::GetCurrent().Add( scrollView );
769 // Set up a gesture to perform.
770 Vector2 startPos( 0.0f, 50.0f );
771 Vector2 direction( 0.0f, -6.0f );
774 // Force starting position.
775 scrollView.ScrollTo( startPos, 0.0f );
778 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
779 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
781 // Confirm the final X coord has not moved more than one page from the start X position.
782 DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
784 // Finish the gesture and wait for the snap.
785 currentPos += direction;
786 SendPan( application, Gesture::Finished, currentPos );
787 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
788 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
790 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
791 DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
796 int UtcDaliToolkitScrollModeP4(void)
798 ToolkitTestApplication application;
799 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property, DefaultRulers" );
801 // Set up a scrollView.
802 ScrollView scrollView = ScrollView::New();
804 // Do not rely on stage size for UTC tests.
805 Vector2 pageSize( 720.0f, 1280.0f );
806 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
807 scrollView.SetSize( pageSize );
808 scrollView.SetParentOrigin( ParentOrigin::TOP_LEFT );
809 scrollView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
810 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
812 // Position rulers - expect Default rulers to be used which don't snap
813 Property::Map rulerMap;
814 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
815 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
816 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
818 scrollView.SetWrapMode( false );
819 scrollView.SetScrollSensitive( true );
821 Stage::GetCurrent().Add( scrollView );
823 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
825 scrollView.ScrollTo(START_POSITION, 0.0f);
827 // Try a vertical swipe.
828 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
829 // Take into account resampling done when prediction is off.
830 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
836 int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void)
838 ToolkitTestApplication application;
839 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP");
841 ScrollView scrollView = ScrollView::New();
842 Stage::GetCurrent().Add( scrollView );
843 RulerPtr rulerX = new FixedRuler( 100.0f );
844 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
845 RulerPtr rulerY = new FixedRuler( 100.0f );
846 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
848 scrollView.SetRulerX( rulerX );
849 scrollView.SetRulerY( rulerY );
851 scrollView.SetWrapMode(true);
853 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasLeft );
855 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
856 // Check that the scroll position remains the same
857 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
859 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
860 // Check that it stays at the same page (i.e. the same scroll position)
861 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
862 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
864 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasRight );
866 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
867 // Check that it scrolls towards the right
868 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition().x > 0.0f );
870 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
871 // Check that it scrolls back to the same page (i.e. the same scroll position)
872 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
873 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
878 int UtcDaliToolkitScrollViewScrollToActorP(void)
880 ToolkitTestApplication application;
881 tet_infoline(" UtcDaliToolkitScrollViewScrollToActorP");
883 ScrollView scrollView = ScrollView::New();
884 Stage::GetCurrent().Add( scrollView );
886 Actor actorA = Actor::New();
887 const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f);
888 actorA.SetPosition(positionA);
889 scrollView.Add(actorA);
891 Actor actorB = Actor::New();
892 const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f);
893 actorB.SetPosition(positionB);
894 scrollView.Add(actorB);
898 scrollView.ScrollTo(actorA, 0.0f);
900 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
903 scrollView.ScrollTo(actorB, 0.0f);
905 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
907 scrollView.ScrollTo(actorA);
908 Wait(application, RENDER_DELAY_SCROLL);
909 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
911 scrollView.ScrollTo(actorB);
912 Wait(application, RENDER_DELAY_SCROLL);
913 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
917 int UtcDaliToolkitScrollViewScrollToSnapPointP(void)
919 ToolkitTestApplication application;
920 tet_infoline(" UtcDaliToolkitScrollViewScrollToSnapPointP");
922 ScrollView scrollView = ScrollView::New();
923 Stage::GetCurrent().Add( scrollView );
924 RulerPtr rulerX = new FixedRuler( 100.0f );
925 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
926 RulerPtr rulerY = new FixedRuler( 100.0f );
927 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
929 scrollView.SetRulerX( rulerX );
930 scrollView.SetRulerY( rulerY );
932 scrollView.ScrollTo( Vector2(120.0f, 190.0f), 0.0f );
934 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(120.0f, 190.0f), TEST_LOCATION );
936 scrollView.ScrollToSnapPoint();
938 Wait(application, RENDER_DELAY_SCROLL);
939 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 200.0f), TEST_LOCATION );
943 int UtcDaliToolkitScrollViewSetScrollUpdateDistanceP(void)
945 ToolkitTestApplication application;
946 tet_infoline(" UtcDaliToolkitScrollViewSetScrollUpdateDistanceP");
948 ScrollView scrollView = ScrollView::New();
950 scrollView.SetScrollUpdateDistance(0);
951 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 0, TEST_LOCATION);
952 scrollView.SetScrollUpdateDistance(10);
953 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 10, TEST_LOCATION);
954 scrollView.SetScrollUpdateDistance(1000);
955 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 1000, TEST_LOCATION);
959 int UtcDaliToolkitScrollViewSetWrapModeP(void)
961 ToolkitTestApplication application;
962 tet_infoline(" UtcDaliToolkitScrollViewSetWrapModeP");
964 ScrollView scrollView = ScrollView::New();
965 Stage::GetCurrent().Add( scrollView );
967 Actor actor = Actor::New();
968 scrollView.Add( actor );
970 // Position rulers. 4x4 grid.
971 RulerPtr rulerX = new FixedRuler(50.0f);
972 RulerPtr rulerY = new FixedRuler(50.0f);
973 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) );
974 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) );
975 scrollView.SetRulerX(rulerX);
976 scrollView.SetRulerY(rulerY);
978 scrollView.SetWrapMode(false);
979 scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
981 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
983 scrollView.SetWrapMode(true);
984 scrollView.ScrollTo(Vector2(230.0f, 130.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
986 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 13, TEST_LOCATION );
990 int UtcDaliToolkitScrollViewActorAutoSnap(void)
992 ToolkitTestApplication application;
993 tet_infoline(" UtcDaliToolkitScrollViewActorAutoSnap");
995 ScrollView scrollView = ScrollView::New();
996 Stage::GetCurrent().Add( scrollView );
999 RulerPtr rulerX = new DefaultRuler();
1000 RulerPtr rulerY = new DefaultRuler();
1001 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1002 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1003 scrollView.SetRulerX(rulerX);
1004 scrollView.SetRulerY(rulerY);
1006 const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f);
1007 Actor a = Actor::New();
1009 a.SetPosition(aPosition);
1011 const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f);
1012 Actor b = Actor::New();
1014 b.SetPosition(bPosition);
1016 // Goto a random position, and execute snap (should not move)
1017 Vector2 targetScroll = Vector2(500.0f, 500.0f);
1018 scrollView.ScrollTo(targetScroll, 0.0f);
1020 scrollView.ScrollToSnapPoint();
1021 Wait(application, RENDER_DELAY_SCROLL);
1022 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION );
1024 // Enable ActorAutoSnap, and now try snapping.
1025 scrollView.SetActorAutoSnap(true);
1026 scrollView.ScrollToSnapPoint();
1027 Wait(application, RENDER_DELAY_SCROLL);
1028 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition.GetVectorXY(), TEST_LOCATION );
1030 scrollView.ScrollTo(Vector2(0.0f, 0.0f), 0.0f);
1032 scrollView.ScrollToSnapPoint();
1033 Wait(application, RENDER_DELAY_SCROLL);
1034 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition.GetVectorXY(), TEST_LOCATION );
1038 int UtcDaliToolkitScrollViewSignalsStartComplete(void)
1040 ToolkitTestApplication application;
1041 tet_infoline(" UtcDaliToolkitScrollViewSignalsStartComplete");
1043 gOnScrollStartCalled = false;
1044 gOnScrollCompleteCalled = false;
1046 ScrollView scrollView = ScrollView::New();
1047 Stage::GetCurrent().Add( scrollView );
1050 RulerPtr rulerX = new DefaultRuler();
1051 RulerPtr rulerY = new DefaultRuler();
1052 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1053 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1054 scrollView.SetRulerX(rulerX);
1055 scrollView.SetRulerY(rulerY);
1056 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1057 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1058 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1059 scrollView.ScrollTo( Vector2(100.0f, 100.0f) );
1060 Wait(application, RENDER_DELAY_SCROLL);
1062 DALI_TEST_CHECK(gOnScrollStartCalled);
1063 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1067 int UtcDaliToolkitScrollViewSignalsUpdate01(void)
1069 ToolkitTestApplication application;
1070 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1072 gOnScrollStartCalled = false;
1073 gOnScrollUpdateCalled = false;
1074 gOnScrollCompleteCalled = false;
1076 ScrollView scrollView = ScrollView::New();
1077 Stage::GetCurrent().Add( scrollView );
1078 Vector2 stageSize = Stage::GetCurrent().GetSize();
1079 scrollView.SetSize(stageSize);
1080 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1081 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1084 RulerPtr rulerX = new DefaultRuler();
1085 RulerPtr rulerY = new DefaultRuler();
1086 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1087 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1088 scrollView.SetRulerX(rulerX);
1089 scrollView.SetRulerY(rulerY);
1090 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1091 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1092 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1094 Actor image = Actor::New();
1095 image.SetSize(stageSize);
1096 image.SetParentOrigin(ParentOrigin::TOP_LEFT);
1097 image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1098 scrollView.Add(image);
1102 // Do a pan starting from 100,100 and moving down diagonally.
1103 Vector2 pos(100.0f, 100.0f);
1104 SendPan(application, Gesture::Possible, pos);
1105 SendPan(application, Gesture::Started, pos);
1108 Wait(application, 100);
1110 for(int i = 0;i<20;i++)
1112 SendPan(application, Gesture::Continuing, pos);
1118 SendPan(application, Gesture::Finished, pos);
1119 Wait(application, RENDER_DELAY_SCROLL);
1121 DALI_TEST_CHECK(gOnScrollStartCalled);
1122 DALI_TEST_CHECK(gOnScrollUpdateCalled);
1123 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1127 int UtcDaliToolkitScrollViewSignalsUpdate02(void)
1129 ToolkitTestApplication application;
1130 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1132 gOnScrollStartCalled = false;
1133 gOnScrollUpdateCalled = false;
1134 gOnScrollCompleteCalled = false;
1136 ScrollView scrollView = ScrollView::New();
1137 Stage::GetCurrent().Add( scrollView );
1138 Vector2 stageSize = Stage::GetCurrent().GetSize();
1139 scrollView.SetSize(stageSize);
1140 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1141 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1144 RulerPtr rulerX = new DefaultRuler();
1145 RulerPtr rulerY = new DefaultRuler();
1146 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1147 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1148 scrollView.SetRulerX(rulerX);
1149 scrollView.SetRulerY(rulerY);
1150 Dali::ConnectionTracker tracker;
1151 bool scrollStarted=false;
1152 bool scrollUpdated=false;
1153 bool scrollCompleted=false;
1154 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) ));
1155 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) ));
1156 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) ));
1158 Actor image = Actor::New();
1159 image.SetSize(stageSize);
1160 image.SetParentOrigin(ParentOrigin::TOP_LEFT);
1161 image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1162 scrollView.Add(image);
1166 // Do a pan starting from 100,100 and moving down diagonally.
1167 Vector2 pos(100.0f, 100.0f);
1168 SendPan(application, Gesture::Possible, pos);
1169 SendPan(application, Gesture::Started, pos);
1172 Wait(application, 100);
1174 for(int i = 0;i<20;i++)
1176 SendPan(application, Gesture::Continuing, pos);
1182 SendPan(application, Gesture::Finished, pos);
1183 Wait(application, RENDER_DELAY_SCROLL);
1185 DALI_TEST_CHECK(scrollStarted);
1186 DALI_TEST_CHECK(scrollUpdated);
1187 DALI_TEST_CHECK(scrollCompleted);
1189 Stage::GetCurrent().Remove( scrollView );
1194 int UtcDaliToolkitScrollViewScrollSensitive(void)
1196 ToolkitTestApplication application;
1197 tet_infoline(" UtcDaliToolkitScrollViewScrollSensitive");
1199 // Set up a scrollView...
1200 ScrollView scrollView = ScrollView::New();
1201 scrollView.SetOvershootEnabled(true);
1202 Stage::GetCurrent().Add( scrollView );
1203 Vector2 stageSize = Stage::GetCurrent().GetSize();
1204 scrollView.SetSize(stageSize);
1205 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1206 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1209 RulerPtr rulerX = new DefaultRuler();
1210 RulerPtr rulerY = new DefaultRuler();
1211 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1212 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1213 scrollView.SetRulerX(rulerX);
1214 scrollView.SetRulerY(rulerY);
1215 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1216 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1217 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1218 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1220 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1223 // First try insensitive swipe.
1224 scrollView.SetScrollSensitive(false);
1225 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1227 DALI_TEST_CHECK( !gOnScrollStartCalled );
1228 DALI_TEST_CHECK( !gOnScrollCompleteCalled );
1229 DALI_TEST_CHECK( !gOnSnapStartCalled );
1231 // Second try sensitive swipe.
1232 scrollView.SetScrollSensitive(true);
1233 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1235 DALI_TEST_CHECK( gOnScrollStartCalled );
1236 DALI_TEST_CHECK( gOnScrollCompleteCalled );
1237 DALI_TEST_CHECK( gOnSnapStartCalled );
1241 int UtcDaliToolkitScrollViewAxisAutoLock(void)
1243 ToolkitTestApplication application;
1244 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLock");
1246 // Set up a scrollView...
1247 ScrollView scrollView = ScrollView::New();
1248 Stage::GetCurrent().Add( scrollView );
1249 Vector2 stageSize = Stage::GetCurrent().GetSize();
1250 scrollView.SetSize(stageSize);
1251 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1252 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1255 RulerPtr rulerX = new DefaultRuler();
1256 RulerPtr rulerY = new DefaultRuler();
1257 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1258 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1259 scrollView.SetRulerX(rulerX);
1260 scrollView.SetRulerY(rulerY);
1261 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1262 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1263 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1266 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1268 Vector2 startPosition = scrollView.GetCurrentScrollPosition();
1269 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1270 const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
1273 scrollView.SetAxisAutoLock(true);
1274 DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
1276 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1278 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1279 const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
1281 // compare how much the Y position has deviated for normal and autolock.
1282 const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
1283 const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
1285 // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
1286 DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
1288 scrollView.SetAxisAutoLock(false);
1289 DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
1293 int UtcDaliToolkitScrollViewAxisAutoLockGradient(void)
1295 ToolkitTestApplication application;
1296 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLockGradient");
1298 // Set up a scrollView...
1299 ScrollView scrollView = ScrollView::New();
1300 scrollView.SetAxisAutoLockGradient(0.5f);
1301 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
1302 scrollView.SetAxisAutoLockGradient(1.0f);
1303 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
1307 int UtcDaliToolkitScrollViewConstraints(void)
1309 ToolkitTestApplication application;
1310 tet_infoline(" UtcDaliToolkitScrollViewConstraints");
1312 // Set up a scrollView...
1313 ScrollView scrollView = ScrollView::New();
1314 Stage::GetCurrent().Add( scrollView );
1315 Vector2 stageSize = Stage::GetCurrent().GetSize();
1316 scrollView.SetSize(stageSize);
1317 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1318 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1321 RulerPtr rulerX = new DefaultRuler();
1322 RulerPtr rulerY = new DefaultRuler();
1323 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1324 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1325 scrollView.SetRulerX(rulerX);
1326 scrollView.SetRulerY(rulerY);
1328 // Add an Actor to ScrollView,
1329 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1330 gConstraintResult = Vector3::ZERO;
1331 Actor a = Actor::New();
1333 a.SetPosition( TEST_ACTOR_POSITION );
1336 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1337 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1338 constraint.SetRemoveAction(Constraint::Discard);
1339 scrollView.ApplyConstraintToChildren(constraint);
1342 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1344 gConstraintResult = Vector3::ZERO;
1345 scrollView.RemoveConstraintsFromChildren();
1348 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1352 int UtcDaliToolkitScrollViewBind(void)
1354 ToolkitTestApplication application;
1355 tet_infoline(" UtcDaliToolkitScrollViewBind");
1357 // Set up a scrollView...
1358 ScrollView scrollView = ScrollView::New();
1359 Stage::GetCurrent().Add( scrollView );
1360 Vector2 stageSize = Stage::GetCurrent().GetSize();
1361 scrollView.SetSize(stageSize);
1362 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1363 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1366 RulerPtr rulerX = new DefaultRuler();
1367 RulerPtr rulerY = new DefaultRuler();
1368 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1369 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1370 scrollView.SetRulerX(rulerX);
1371 scrollView.SetRulerY(rulerY);
1373 // Add an Actor to ScrollView,
1374 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1376 gConstraintResult = Vector3::ZERO;
1377 Actor a = Actor::New();
1379 a.SetPosition( TEST_ACTOR_POSITION );
1382 // apply this constraint to scrollview
1383 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1384 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1385 constraint.SetRemoveAction(Constraint::Discard);
1386 scrollView.ApplyConstraintToChildren(constraint);
1390 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1393 gConstraintResult = Vector3::ZERO;
1394 scrollView.UnbindActor( a );
1396 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1399 gConstraintResult = Vector3::ZERO;
1400 scrollView.BindActor( a );
1402 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1406 int UtcDaliToolkitScrollViewOvershoot(void)
1408 ToolkitTestApplication application;
1409 tet_infoline(" UtcDaliToolkitScrollViewOvershoot");
1411 // Set up a scrollView...
1412 ScrollView scrollView = ScrollView::New();
1413 scrollView.SetOvershootEnabled(true);
1415 Vector2 overshootSize = Vector2(100.0f,100.0f);
1416 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
1417 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
1419 Stage::GetCurrent().Add( scrollView );
1420 Vector2 stageSize = Stage::GetCurrent().GetSize();
1421 scrollView.SetSize(stageSize);
1422 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1423 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1426 RulerPtr rulerX = new DefaultRuler();
1427 RulerPtr rulerY = new DefaultRuler();
1428 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1429 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1430 scrollView.SetRulerX(rulerX);
1431 scrollView.SetRulerY(rulerY);
1432 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1433 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1434 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1436 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1439 // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
1440 Vector2 currentPos = Vector2(100.0f, 100.0f);
1441 currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
1442 float overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1443 float overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1444 Vector2 positionValue = DevelHandle::GetCurrentProperty< Vector2 >( scrollView, ScrollView::Property::SCROLL_POSITION );
1445 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1446 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1447 DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION);
1449 float timeToReachOrigin;
1451 // Now release touch. Overshoot should snap back to zero.
1452 SendPan(application, Gesture::Finished, currentPos);
1453 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1455 float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1456 float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1458 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1459 (timeToReachOrigin < maxTimeToReachOrigin) );
1461 // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
1462 scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
1464 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1465 // Now release touch. Overshoot should snap back to zero.
1466 SendPan(application, Gesture::Finished, currentPos);
1467 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1469 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1470 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1472 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1473 (timeToReachOrigin < maxTimeToReachOrigin) );
1475 // 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
1476 scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
1478 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1479 // Now release touch. Overshoot should snap back to zero.
1480 SendPan(application, Gesture::Finished, currentPos);
1481 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1483 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1484 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1486 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1487 (timeToReachOrigin < maxTimeToReachOrigin) );
1489 // 4. Repeat Scroll, but this time change overshoot function.
1490 scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
1491 scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
1493 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1494 // Now release touch. Overshoot should snap back to zero.
1495 SendPan(application, Gesture::Finished, currentPos);
1496 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1498 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1499 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1501 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1502 (timeToReachOrigin < maxTimeToReachOrigin) );
1506 int UtcDaliToolkitScrollViewSnapAlphaFunction(void)
1508 ToolkitTestApplication application;
1509 tet_infoline(" UtcDaliToolkitScrollViewSnapAlphaFunction");
1511 // Set up a scrollView...
1512 ScrollView scrollView = ScrollView::New();
1513 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_IN );
1514 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_IN );
1515 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_OUT );
1516 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_OUT );
1518 scrollView.SetScrollFlickAlphaFunction( AlphaFunction::BOUNCE );
1519 DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction().GetBuiltinFunction() == AlphaFunction::BOUNCE );
1524 int UtcDaliToolkitScrollViewSnapDuration(void)
1526 ToolkitTestApplication application;
1527 tet_infoline(" UtcDaliToolkitScrollViewSnapDuration");
1529 // Set up a scrollView...
1530 ScrollView scrollView = ScrollView::New();
1531 scrollView.SetScrollSnapDuration( 1.0f );
1532 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION );
1533 scrollView.SetScrollSnapDuration( 0.5f );
1534 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION );
1536 scrollView.SetScrollFlickDuration( 2.0f );
1537 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION );
1538 scrollView.SetScrollFlickDuration( 1.5f );
1539 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION );
1543 int UtcDaliToolkitScrollViewSnapStartedSignalP(void)
1545 ToolkitTestApplication application;
1546 tet_infoline(" UtcDaliToolkitScrollViewSnapStartedSignalP");
1548 // Set up a scrollView...
1549 ScrollView scrollView = ScrollView::New();
1550 Stage::GetCurrent().Add( scrollView );
1551 Vector2 stageSize = Stage::GetCurrent().GetSize();
1552 scrollView.SetSize(stageSize);
1553 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1554 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1557 RulerPtr rulerX = new DefaultRuler();
1558 RulerPtr rulerY = new DefaultRuler();
1559 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1560 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1561 scrollView.SetRulerX(rulerX);
1562 scrollView.SetRulerY(rulerY);
1563 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1565 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1568 // First try a snap.
1569 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true);
1571 DALI_TEST_CHECK( gOnSnapStartCalled );
1572 DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
1574 // Second try a swipe.
1575 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true);
1577 DALI_TEST_CHECK( gOnSnapStartCalled );
1578 DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
1582 int UtcDaliToolkitScrollViewGetCurrentPageP(void)
1584 ToolkitTestApplication application;
1585 tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP");
1587 ScrollView scrollView = ScrollView::New();
1588 Stage::GetCurrent().Add( scrollView );
1589 RulerPtr rulerX = new FixedRuler( 100.0f );
1590 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1591 RulerPtr rulerY = new FixedRuler( 100.0f );
1592 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1594 scrollView.SetRulerX( rulerX );
1595 scrollView.SetRulerY( rulerY );
1597 scrollView.ScrollTo( 15 );
1598 Wait(application, RENDER_DELAY_SCROLL);
1599 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
1601 scrollView.ScrollTo( 3 );
1602 Wait(application, RENDER_DELAY_SCROLL);
1603 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
1605 scrollView.ScrollTo( 9 );
1606 Wait(application, RENDER_DELAY_SCROLL);
1607 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
1612 int UtcDaliToolkitScrollViewSetMaxOvershootP(void)
1614 ToolkitTestApplication application;
1615 tet_infoline(" UtcDaliToolkitScrollViewSetMaxOvershootP");
1617 // Set up a scrollView...
1618 ScrollView scrollView = ScrollView::New();
1619 Stage::GetCurrent().Add( scrollView );
1620 Vector2 stageSize = Stage::GetCurrent().GetSize();
1621 scrollView.SetSize(stageSize);
1622 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1623 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1626 RulerPtr rulerX = new DefaultRuler();
1627 RulerPtr rulerY = new DefaultRuler();
1628 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1629 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1630 scrollView.SetRulerX(rulerX);
1631 scrollView.SetRulerY(rulerY);
1633 // Set the max overshoot to be 50 pixels in both X axis and Y axis
1634 scrollView.SetMaxOvershoot(50.0f, 50.0f);
1636 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1639 // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
1640 Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false);
1641 float overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1642 float overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1643 DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
1644 DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
1646 // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
1647 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false);
1648 overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1649 overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1650 // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
1651 // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
1652 float correctOvershootValue = 50.0f / 105.f;
1653 DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1654 DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1656 // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1657 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1658 overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1659 overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1660 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1661 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1663 // Change the max overshoot to be 100 pixels in both X axis and Y axis
1664 scrollView.SetMaxOvershoot(100.0f, 100.0f);
1667 // Check that overshoot should be now around 0.8.
1668 overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1669 overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1670 DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
1671 DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
1673 // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1674 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1675 overshootXValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_X );
1676 overshootYValue = DevelHandle::GetCurrentProperty< float >( scrollView, ScrollView::Property::OVERSHOOT_Y );
1677 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1678 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1683 int UtcDaliToolkitScrollViewSetScrollingDirectionP(void)
1685 ToolkitTestApplication application;
1686 tet_infoline(" UtcDaliToolkitScrollViewSetScrollingDirectionP");
1688 // Set up a scrollView...
1689 ScrollView scrollView = ScrollView::New();
1690 Stage::GetCurrent().Add( scrollView );
1691 Vector2 stageSize = Stage::GetCurrent().GetSize();
1692 scrollView.SetSize(stageSize);
1693 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1694 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1696 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1698 scrollView.ScrollTo(START_POSITION, 0.0f);
1700 // Try a vertical swipe.
1701 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1702 // Take into account resampling done when prediction is off.
1703 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1705 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1707 scrollView.ScrollTo(START_POSITION, 0.0f);
1709 // Try a vertical swipe.
1710 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1711 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1713 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1715 scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1717 // Try a vertical swipe.
1718 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1719 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1724 int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void)
1726 ToolkitTestApplication application;
1727 tet_infoline(" UtcDaliToolkitScrollViewRemoveScrollingDirectionP");
1729 // Set up a scrollView...
1730 ScrollView scrollView = ScrollView::New();
1731 Stage::GetCurrent().Add( scrollView );
1732 Vector2 stageSize = Stage::GetCurrent().GetSize();
1733 scrollView.SetSize(stageSize);
1734 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1735 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1737 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1739 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1741 scrollView.ScrollTo(START_POSITION, 0.0f);
1743 // Try a vertical swipe.
1744 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1745 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1747 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1749 scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1751 // Try a vertical swipe.
1752 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1753 // Take into account resampling done when prediction is off.
1754 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1759 int UtcDaliToolkitScrollViewSetRulerXP(void)
1761 ToolkitTestApplication application;
1762 tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP");
1764 ScrollView scrollView = ScrollView::New();
1765 Stage::GetCurrent().Add( scrollView );
1766 RulerPtr rulerX = new FixedRuler( 100.0f );
1767 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1769 scrollView.SetRulerX( rulerX );
1771 scrollView.ScrollTo( 1, 0.0f );
1773 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
1775 RulerPtr newRulerX = new FixedRuler( 200.0f );
1776 newRulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1778 scrollView.SetRulerX( newRulerX );
1780 scrollView.ScrollTo( 1, 0.0f );
1782 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 0.0f), TEST_LOCATION );
1787 int UtcDaliToolkitScrollViewSetRulerYP(void)
1789 ToolkitTestApplication application;
1790 tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP");
1792 ScrollView scrollView = ScrollView::New();
1793 Stage::GetCurrent().Add( scrollView );
1795 RulerPtr rulerY = new FixedRuler( 200.0f );
1796 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1798 scrollView.SetRulerY( rulerY );
1800 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1802 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 350.0f), TEST_LOCATION );
1804 RulerPtr newRulerY = new FixedRuler( 100.0f );
1805 newRulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
1806 scrollView.SetRulerY( newRulerY );
1808 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1810 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 200.0f), TEST_LOCATION );
1815 int UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP(void)
1817 ToolkitTestApplication application;
1818 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP");
1820 ScrollView scrollView = ScrollView::New();
1821 scrollView.SetMinimumSpeedForFlick(25.0f);
1822 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 25.0f, TEST_LOCATION );
1823 scrollView.SetMinimumSpeedForFlick(60.0f);
1824 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 60.0f, TEST_LOCATION );
1828 int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void)
1830 ToolkitTestApplication application;
1831 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumDistanceForFlick");
1833 ScrollView scrollView = ScrollView::New();
1835 scrollView.SetMinimumDistanceForFlick(Vector2(30.0f, 15.0f));
1836 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1837 scrollView.SetMinimumDistanceForFlick(Vector2(60.0f, 30.0f));
1838 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1842 int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void)
1844 ToolkitTestApplication application;
1845 tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP");
1847 ScrollView scrollView = ScrollView::New();
1848 // Disable Refresh signal (TET environment cannot use adaptor's Timer)
1849 scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
1850 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1851 scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
1852 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1856 int UtcDaliToolkitScrollViewApplyEffectP(void)
1858 ToolkitTestApplication application;
1859 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectP");
1861 // Create a ScrollView
1862 ScrollView scrollView = ScrollView::New();
1864 // Create two scroll view effects
1865 Dali::Path path = Dali::Path::New();
1866 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);
1867 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);
1869 // Apply both effects
1870 scrollView.ApplyEffect(effect);
1871 scrollView.ApplyEffect(newEffect);
1873 DALI_TEST_CHECK( true );
1878 int UtcDaliToolkitScrollViewApplyEffectN(void)
1880 ToolkitTestApplication application;
1881 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectN");
1883 // Create a ScrollView
1884 ScrollView scrollView = ScrollView::New();
1886 // Create two scroll view effects
1887 Dali::Path path = Dali::Path::New();
1888 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);
1889 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);
1891 // Apply both effects
1892 scrollView.ApplyEffect(effect);
1893 scrollView.ApplyEffect(newEffect);
1895 // Attempt to apply the same effect again
1898 scrollView.ApplyEffect(newEffect);
1899 tet_result( TET_FAIL );
1901 catch ( DaliException& e )
1903 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1909 int UtcDaliToolkitScrollViewRemoveEffectP(void)
1911 ToolkitTestApplication application;
1912 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectP");
1914 // Create a ScrollView
1915 ScrollView scrollView = ScrollView::New();
1917 // Create two scroll view effects
1918 Dali::Path path = Dali::Path::New();
1919 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);
1920 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);
1922 // Apply both effects
1923 scrollView.ApplyEffect(effect);
1924 scrollView.ApplyEffect(newEffect);
1926 // Remove both effects
1927 scrollView.RemoveEffect(effect);
1928 scrollView.RemoveEffect(newEffect);
1930 DALI_TEST_CHECK( true );
1935 int UtcDaliToolkitScrollViewRemoveEffectN(void)
1937 ToolkitTestApplication application;
1938 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectN");
1940 // Create a ScrollView
1941 ScrollView scrollView = ScrollView::New();
1943 // Create two scroll view effects
1944 Dali::Path path = Dali::Path::New();
1945 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);
1946 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);
1948 // Apply the first effect
1949 scrollView.ApplyEffect(effect);
1951 // Attempt to remove the second effect which has not been applied to scroll view
1954 scrollView.RemoveEffect(newEffect);
1955 tet_result( TET_FAIL );
1957 catch ( DaliException& e )
1959 DALI_TEST_ASSERT( e, "effectExistedInScrollView", TEST_LOCATION );
1965 int UtcDaliToolkitScrollViewRemoveAllEffectsP(void)
1967 ToolkitTestApplication application;
1968 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsP");
1970 // Create a ScrollView
1971 ScrollView scrollView = ScrollView::New();
1973 // Create two scroll view effects
1974 Dali::Path path = Dali::Path::New();
1975 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);
1976 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);
1978 // Apply both effects
1979 scrollView.ApplyEffect(effect);
1980 scrollView.ApplyEffect(newEffect);
1982 // Attempt to apply the same first effect again
1985 scrollView.ApplyEffect(effect);
1986 tet_result( TET_FAIL );
1988 catch ( DaliException& e )
1990 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1993 // Remove both effects
1994 scrollView.RemoveAllEffects();
1996 // Apply both effects again
1997 scrollView.ApplyEffect(effect);
1998 scrollView.ApplyEffect(newEffect);
2000 DALI_TEST_CHECK( true );
2005 int UtcDaliToolkitScrollViewRemoveAllEffectsN(void)
2007 ToolkitTestApplication application;
2008 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsN");
2010 // Create a ScrollView
2011 ScrollView scrollView = ScrollView::New();
2013 // Remove effects when there is no effect applied previously
2014 scrollView.RemoveAllEffects();
2016 DALI_TEST_CHECK( true );
2021 int UtcDaliToolkitScrollViewSetOvershootEnabledP(void)
2023 ToolkitTestApplication application;
2024 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEnabledP");
2026 ScrollView scrollView = ScrollView::New();
2028 scrollView.SetOvershootEnabled(true);
2029 DALI_TEST_CHECK(scrollView.IsOvershootEnabled());
2031 scrollView.SetOvershootEnabled(false);
2032 DALI_TEST_CHECK(!scrollView.IsOvershootEnabled());
2037 int UtcDaliToolkitScrollViewSetOvershootEffectColorP(void)
2039 ToolkitTestApplication application;
2040 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEffectColorP");
2042 ScrollView scrollView = ScrollView::New();
2044 scrollView.SetOvershootEffectColor(Dali::Color::RED);
2045 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::RED, TEST_LOCATION);
2047 scrollView.SetOvershootEffectColor(Dali::Color::YELLOW);
2048 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::YELLOW, TEST_LOCATION);
2053 int UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP(void)
2055 ToolkitTestApplication application;
2056 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP");
2058 ScrollView scrollView = ScrollView::New();
2060 scrollView.SetOvershootAnimationSpeed(55.0f);
2061 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 55.0f, TEST_LOCATION);
2063 scrollView.SetOvershootAnimationSpeed(120.0f);
2064 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 120.0f, TEST_LOCATION);
2069 int UtcDaliToolkitScrollViewGetSet(void)
2071 ToolkitTestApplication application;
2072 tet_infoline(" UtcDaliToolkitScrollViewGetSet");
2073 ScrollView scrollView = ScrollView::New();
2074 scrollView.SetMaxFlickSpeed(0.5f);
2075 DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2076 scrollView.SetFrictionCoefficient(0.6f);
2077 DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2078 scrollView.SetFlickSpeedCoefficient(0.7f);
2079 DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2083 int UtcDaliToolkitScrollViewRulerDomainConstructorP(void)
2085 ToolkitTestApplication application;
2087 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2088 DALI_TEST_EQUALS( domainX.min, 0.0f, TEST_LOCATION);
2089 DALI_TEST_EQUALS( domainX.max, 200.0f, TEST_LOCATION);
2090 DALI_TEST_EQUALS( domainX.enabled, true, TEST_LOCATION);
2092 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2093 DALI_TEST_EQUALS( domainY.min, 100.0f, TEST_LOCATION);
2094 DALI_TEST_EQUALS( domainY.max, 500.0f, TEST_LOCATION);
2095 DALI_TEST_EQUALS( domainY.enabled, false, TEST_LOCATION);
2100 int UtcDaliToolkitScrollViewRulerDomainGetSizeP(void)
2102 ToolkitTestApplication application;
2104 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2105 DALI_TEST_EQUALS( domainX.GetSize(), 200.0f, TEST_LOCATION);
2107 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2108 DALI_TEST_EQUALS( domainY.GetSize(), 400.0f, TEST_LOCATION);
2113 int UtcDaliToolkitScrollViewRulerDomainClampP(void)
2115 ToolkitTestApplication application;
2117 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2119 float value = domainX.Clamp(50.0f, 100.0f, 1.0f);
2120 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2122 value = domainX.Clamp(300.0f, 20.0f, 1.0f);
2123 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2125 value = domainX.Clamp(300.0f, 20.0f, 0.5f);
2126 DALI_TEST_EQUALS( value, 80.0f, TEST_LOCATION);
2128 value = domainX.Clamp(250.0f, 200.0f, 2.0f);
2129 DALI_TEST_EQUALS( value, 200.0f, TEST_LOCATION);
2134 int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void)
2136 ToolkitTestApplication application;
2138 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2141 float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped);
2142 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2143 DALI_TEST_EQUALS( clamped, Dali::Toolkit::NotClamped, TEST_LOCATION);
2145 value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped);
2146 DALI_TEST_EQUALS( value, 0.0f, TEST_LOCATION);
2147 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMin, TEST_LOCATION);
2149 value = domainX.Clamp(300.0f, 20.0f, 1.0f, clamped);
2150 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2151 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMax, TEST_LOCATION);
2156 int UtcDaliToolkitScrollViewDefaultRulerConstructorP(void)
2158 ToolkitTestApplication application;
2159 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerConstructorP");
2161 RulerPtr defaultRuler = new DefaultRuler();
2162 DALI_TEST_CHECK( defaultRuler );
2167 int UtcDaliToolkitScrollViewDefaultRulerDestructorP(void)
2169 ToolkitTestApplication application;
2170 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerDestructorP");
2172 RulerPtr defaultRuler = new DefaultRuler();
2174 DALI_TEST_CHECK( true );
2178 int UtcDaliToolkitScrollViewFixedRulerConstructorP(void)
2180 ToolkitTestApplication application;
2181 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerConstructorP");
2183 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2184 DALI_TEST_CHECK( fixedRuler );
2186 fixedRuler = new FixedRuler( 0.0f );
2187 DALI_TEST_CHECK( fixedRuler );
2192 int UtcDaliToolkitScrollViewFixedRulerDestructorP(void)
2194 ToolkitTestApplication application;
2195 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerDestructorP");
2197 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2199 DALI_TEST_CHECK( true );
2203 int UtcDaliToolkitScrollViewRulerGetTypeP(void)
2205 ToolkitTestApplication application;
2206 tet_infoline(" UtcDaliToolkitScrollViewRulerGetTypeP");
2208 RulerPtr defaultRuler = new DefaultRuler();
2209 DALI_TEST_CHECK( defaultRuler );
2210 DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::Free, TEST_LOCATION);
2212 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2213 DALI_TEST_CHECK( fixedRuler );
2214 DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::Fixed, TEST_LOCATION);
2219 int UtcDaliToolkitScrollViewRulerGetExtensionP(void)
2221 ToolkitTestApplication application;
2222 tet_infoline(" UtcDaliToolkitScrollViewRulerGetExtensionP");
2224 RulerPtr defaultRuler = new DefaultRuler();
2225 DALI_TEST_CHECK( defaultRuler );
2226 DALI_TEST_CHECK( !defaultRuler->GetExtension() );
2228 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2229 DALI_TEST_CHECK( fixedRuler );
2230 DALI_TEST_CHECK( !fixedRuler->GetExtension() );
2235 int UtcDaliToolkitScrollViewRulerEnableDisable(void)
2237 ToolkitTestApplication application;
2238 tet_infoline(" UtcDaliToolkitScrollViewRulerEnableDisable");
2240 RulerPtr ruler = new DefaultRuler();
2242 DALI_TEST_CHECK( ruler->IsEnabled() );
2244 DALI_TEST_CHECK( !ruler->IsEnabled() );
2246 DALI_TEST_CHECK( ruler->IsEnabled() );
2250 int UtcDaliToolkitScrollViewRulerDomainEnableDisable(void)
2252 ToolkitTestApplication application;
2253 tet_infoline(" UtcDaliToolkitScrollViewRulerDomainEnableDisable");
2255 RulerPtr ruler = new DefaultRuler();
2256 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2258 ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) );
2259 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION );
2260 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION );
2261 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION );
2263 ruler->DisableDomain();
2264 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2265 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION );
2266 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION );
2270 int UtcDaliToolkitScrollViewRulerSnapAndClamp(void)
2272 ToolkitTestApplication application;
2273 tet_infoline(" UtcDaliToolkitScrollViewRulerSnapAndClamp");
2275 RulerPtr ruler = new FixedRuler( 50.0f );
2276 ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2278 // default testing. (snap and clamp)
2279 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION);
2280 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION);
2281 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION);
2282 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION);
2283 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION);
2284 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION);
2287 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2288 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick
2289 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2291 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2292 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick
2293 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2296 DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary)
2297 DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary)
2298 DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary)
2299 DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary)
2300 DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary)
2303 DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION);
2304 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION);
2305 DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION);
2306 DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION);
2308 // clamp state testing.
2310 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2311 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2312 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2313 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2314 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2315 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2316 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2317 DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION );
2318 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2319 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2320 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2321 DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION );
2325 int UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP(void)
2327 ToolkitTestApplication application;
2328 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP");
2330 RulerPtr rulerNormal = new FixedRuler( 25.0f );
2331 rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) );
2333 unsigned int volume;
2336 position = rulerNormal->GetPositionFromPage(1, volume, true);
2337 DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION );
2338 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2340 position = rulerNormal->GetPositionFromPage(2, volume, true);
2341 DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION );
2342 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2344 // Disable the ruler
2345 rulerNormal->Disable();
2347 position = rulerNormal->GetPositionFromPage(1, volume, true);
2348 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2349 DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION );
2351 position = rulerNormal->GetPositionFromPage(2, volume, true);
2352 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2353 DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION );
2358 int UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP(void)
2360 ToolkitTestApplication application;
2361 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP");
2363 RulerPtr defaultRuler = new DefaultRuler();
2364 DALI_TEST_CHECK( defaultRuler );
2365 DALI_TEST_EQUALS( defaultRuler->GetTotalPages(), 1u, TEST_LOCATION);
2370 int UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP(void)
2372 ToolkitTestApplication application;
2373 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP");
2375 RulerPtr defaultRuler = new DefaultRuler();
2376 DALI_TEST_CHECK( defaultRuler );
2377 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(100.0f, true), 0u, TEST_LOCATION);
2378 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(-300.0f, false), 0u, TEST_LOCATION);
2383 int UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP(void)
2385 ToolkitTestApplication application;
2386 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP");
2388 RulerPtr defaultRuler = new DefaultRuler();
2389 DALI_TEST_CHECK( defaultRuler );
2391 unsigned int volume;
2392 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(0, volume, true), 0.0f, TEST_LOCATION);
2393 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2395 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(3, volume, false), 0.0f, TEST_LOCATION);
2396 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2401 int UtcDaliToolkitScrollViewDefaultRulerSnapP(void)
2403 ToolkitTestApplication application;
2404 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerSnapP");
2406 RulerPtr defaultRuler = new DefaultRuler();
2407 DALI_TEST_CHECK( defaultRuler );
2409 DALI_TEST_EQUALS( defaultRuler->Snap(50.0f, 0.5f), 50.0f, TEST_LOCATION);
2410 DALI_TEST_EQUALS( defaultRuler->Snap(-120.0f, 1.0f), -120.0f, TEST_LOCATION);
2415 int UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP(void)
2417 ToolkitTestApplication application;
2418 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP");
2420 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2421 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2423 fixedRuler->Enable();
2424 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 4u, TEST_LOCATION);
2426 fixedRuler->Disable();
2427 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 1u, TEST_LOCATION);
2432 int UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP(void)
2434 ToolkitTestApplication application;
2435 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP");
2437 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2438 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2440 fixedRuler->Enable();
2441 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 3u, TEST_LOCATION);
2442 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2443 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 1u, TEST_LOCATION);
2444 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2446 fixedRuler->Disable();
2447 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2448 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2449 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2450 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2452 // Set domain size to be smaller than the ruler space
2453 fixedRuler->SetDomain( RulerDomain(0.0f, 50.0f, true) );
2455 fixedRuler->Enable();
2456 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2457 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2458 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2459 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2461 fixedRuler->Disable();
2462 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2463 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2464 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2465 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2470 int UtcDaliToolkitScrollViewFixedRulerSnapP(void)
2472 ToolkitTestApplication application;
2473 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerSnapP");
2475 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2476 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2478 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.0f), -100.0f, TEST_LOCATION);
2479 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.0f), -100.0f, TEST_LOCATION);
2480 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.0f), -200.0f, TEST_LOCATION);
2481 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.0f), -500.0f, TEST_LOCATION);
2482 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.0f), 0.0f, TEST_LOCATION);
2483 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.0f), 0.0f, TEST_LOCATION);
2484 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.0f), 0.0f, TEST_LOCATION);
2485 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.0f), 100.0f, TEST_LOCATION);
2486 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.0f), 100.0f, TEST_LOCATION);
2487 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.0f), 200.0f, TEST_LOCATION);
2488 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.0f), 600.0f, TEST_LOCATION);
2490 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.5f), 0.0f, TEST_LOCATION);
2491 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.5f), -100.0f, TEST_LOCATION);
2492 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.5f), -100.0f, TEST_LOCATION);
2493 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.5f), -500.0f, TEST_LOCATION);
2494 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.5f), 0.0f, TEST_LOCATION);
2495 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.5f), 100.0f, TEST_LOCATION);
2496 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.5f), 100.0f, TEST_LOCATION);
2497 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.5f), 100.0f, TEST_LOCATION);
2498 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.5f), 100.0f, TEST_LOCATION);
2499 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.5f), 300.0f, TEST_LOCATION);
2500 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.5f), 600.0f, TEST_LOCATION);
2502 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 1.0f), 0.0f, TEST_LOCATION);
2503 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 1.0f), 0.0f, TEST_LOCATION);
2504 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 1.0f), -100.0f, TEST_LOCATION);
2505 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 1.0f), -400.0f, TEST_LOCATION);
2506 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 1.0f), 100.0f, TEST_LOCATION);
2507 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 1.0f), 100.0f, TEST_LOCATION);
2508 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 1.0f), 100.0f, TEST_LOCATION);
2509 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 1.0f), 200.0f, TEST_LOCATION);
2510 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 1.0f), 200.0f, TEST_LOCATION);
2511 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 1.0f), 300.0f, TEST_LOCATION);
2512 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 1.0f), 700.0f, TEST_LOCATION);
2517 int UtcDaliToolkitScrollViewConstraintsMove(void)
2519 ToolkitTestApplication application;
2520 tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove");
2522 // Set up a scrollView...
2523 ScrollView scrollView = ScrollView::New();
2524 Stage::GetCurrent().Add( scrollView );
2525 Vector2 stageSize = Stage::GetCurrent().GetSize();
2526 scrollView.SetSize(stageSize);
2527 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2528 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2531 RulerPtr rulerX = new DefaultRuler();
2532 RulerPtr rulerY = new DefaultRuler();
2533 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2534 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2535 scrollView.SetRulerX(rulerX);
2536 scrollView.SetRulerY(rulerY);
2538 // Add an Actor to ScrollView,
2539 Actor a = Actor::New();
2541 a.SetPosition( TEST_ACTOR_POSITION );
2544 const Vector2 target = Vector2(100.0f, 100.0f);
2545 const Vector2 target2 = Vector2(200.0f, 200.0f);
2547 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, MoveActorConstraint );
2548 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
2549 constraint.SetRemoveAction(Constraint::Discard);
2550 scrollView.ApplyConstraintToChildren(constraint);
2552 scrollView.ScrollTo( target, 0.0f );
2554 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2555 scrollView.ScrollTo( target2 );
2556 Wait(application, RENDER_DELAY_SCROLL);
2557 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2562 int UtcDaliToolkitScrollViewConstraintsWrap(void)
2564 ToolkitTestApplication application;
2565 tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap");
2567 // Set up a scrollView...
2568 ScrollView scrollView = ScrollView::New();
2569 Stage::GetCurrent().Add( scrollView );
2570 Vector2 stageSize = Stage::GetCurrent().GetSize();
2571 scrollView.SetSize(stageSize);
2572 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2573 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2576 RulerPtr rulerX = new DefaultRuler();
2577 RulerPtr rulerY = new DefaultRuler();
2578 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2579 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2580 scrollView.SetRulerX(rulerX);
2581 scrollView.SetRulerY(rulerY);
2583 // Add an Actor to ScrollView,
2584 Actor a = Actor::New();
2586 a.SetPosition( TEST_ACTOR_POSITION );
2589 const Vector2 target = Vector2(100.0f, 100.0f);
2590 const Vector2 target2 = Vector2(200.0f, 200.0f);
2592 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, WrapActorConstraint );
2593 constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
2594 constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
2595 constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
2596 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
2597 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
2598 constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) );
2599 constraint.SetRemoveAction(Constraint::Discard);
2600 scrollView.ApplyConstraintToChildren(constraint);
2602 scrollView.ScrollTo( target, 0.0f );
2604 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2605 scrollView.ScrollTo( target2 );
2606 Wait(application, RENDER_DELAY_SCROLL);
2607 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2609 scrollView.Remove(a);
2615 // Non-API test (so no P or N variant).
2616 int UtcDaliToolkitScrollViewGesturePageLimit(void)
2618 ToolkitTestApplication application;
2619 tet_infoline( " UtcDaliToolkitScrollViewGesturePageLimit" );
2621 // Set up a scrollView.
2622 ScrollView scrollView = ScrollView::New();
2624 // Do not rely on stage size for UTC tests.
2625 Vector2 pageSize( 720.0f, 1280.0f );
2626 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
2627 scrollView.SetSize( pageSize );
2628 scrollView.SetParentOrigin( ParentOrigin::CENTER );
2629 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
2630 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
2633 // We set the X ruler to fixed to give us pages to snap to.
2634 Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( pageSize.width );
2635 // Note: The 3x page width is arbitary, but we need enough to show that we are
2636 // capping page movement by the page limiter, and not the domain.
2637 rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, pageSize.width * 3.0f, false ) );
2638 Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler();
2640 scrollView.SetRulerX( rulerX );
2641 scrollView.SetRulerY( rulerY );
2643 scrollView.SetWrapMode( false );
2644 scrollView.SetScrollSensitive( true );
2646 Stage::GetCurrent().Add( scrollView );
2648 // Set up a gesture to perform.
2649 Vector2 startPos( 50.0f, 0.0f );
2650 Vector2 direction( -5.0f, 0.0f );
2653 // Force starting position.
2654 scrollView.ScrollTo( startPos, 0.0f );
2655 Wait( application );
2657 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
2658 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
2660 // Confirm the final X coord has not moved more than one page from the start X position.
2661 DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
2663 // Finish the gesture and wait for the snap.
2664 currentPos += direction;
2665 SendPan( application, Gesture::Finished, currentPos );
2666 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
2667 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
2669 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
2670 DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2675 int UtcDaliScrollViewSetGetProperty(void)
2677 ToolkitTestApplication application;
2679 // Create the ScrollView actor
2680 ScrollView scrollView = ScrollView::New();
2681 DALI_TEST_CHECK(scrollView);
2683 // Event side properties
2685 // Test "wrapEnabled" property
2686 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED );
2687 scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true );
2688 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get<bool>(), true, TEST_LOCATION );
2690 // Test "panningEnabled" property
2691 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED );
2692 scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false );
2693 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get<bool>(), false, TEST_LOCATION );
2695 // Test "axisAutoLockEnabled" property
2696 DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED );
2697 scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false );
2698 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get<bool>(), false, TEST_LOCATION );
2700 // Test "wheelScrollDistanceStep" property
2701 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP );
2702 scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) );
2703 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<Vector2>(), Vector2(100.0f, 50.0f), TEST_LOCATION );
2705 // Test "overshootEnabled" property
2706 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
2707 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), scrollView.IsOvershootEnabled(), TEST_LOCATION );
2708 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
2709 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
2711 // Animatable properties
2713 // Test "scrollPosition" property
2714 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION );
2715 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) );
2717 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get<Vector2>(), Vector2(320.0f, 550.0f), TEST_LOCATION );
2719 // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties
2720 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION );
2721 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) );
2723 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(300.0f, 500.0f), TEST_LOCATION );
2725 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X );
2726 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y );
2727 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 300.0f, TEST_LOCATION );
2728 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 500.0f, TEST_LOCATION );
2729 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f );
2730 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f );
2732 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 400.0f, TEST_LOCATION );
2733 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 600.0f, TEST_LOCATION );
2734 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(400.0f, 600.0f), TEST_LOCATION );
2736 // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties
2737 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX );
2738 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) );
2740 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(100.0f, 200.0f), TEST_LOCATION );
2742 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X );
2743 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y );
2744 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 100.0f, TEST_LOCATION );
2745 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 200.0f, TEST_LOCATION );
2746 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f );
2747 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f );
2749 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 300.0f, TEST_LOCATION );
2750 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 400.0f, TEST_LOCATION );
2751 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(300.0f, 400.0f), TEST_LOCATION );
2753 // Test "overshootX" property
2754 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X );
2755 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f );
2757 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get<float>(), 0.8f, TEST_LOCATION );
2759 // Test "overshootY" property
2760 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y );
2761 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f );
2763 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get<float>(), 0.8f, TEST_LOCATION );
2765 // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties
2766 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL );
2767 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) );
2769 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(200.0f, 300.0f), TEST_LOCATION );
2771 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X );
2772 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y );
2773 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 200.0f, TEST_LOCATION );
2774 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 300.0f, TEST_LOCATION );
2775 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f );
2776 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f );
2778 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 500.0f, TEST_LOCATION );
2779 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 600.0f, TEST_LOCATION );
2780 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(500.0f, 600.0f), TEST_LOCATION );
2782 // Test "wrap" property
2783 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP );
2784 scrollView.SetProperty( ScrollView::Property::WRAP, false );
2786 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get<bool>(), false, TEST_LOCATION );
2788 // Test "panning" property
2789 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING );
2790 scrollView.SetProperty( ScrollView::Property::PANNING, true );
2792 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get<bool>(), true, TEST_LOCATION );
2794 // Test "scrolling" property
2795 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING );
2796 scrollView.SetProperty( ScrollView::Property::SCROLLING, false );
2798 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get<bool>(), false, TEST_LOCATION );
2800 // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties
2801 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE );
2802 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) );
2804 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1200.0f, 1300.0f), TEST_LOCATION );
2806 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
2807 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
2808 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1200.0f, TEST_LOCATION );
2809 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1300.0f, TEST_LOCATION );
2810 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f );
2811 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f );
2813 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1500.0f, TEST_LOCATION );
2814 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1600.0f, TEST_LOCATION );
2815 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1500.0f, 1600.0f), TEST_LOCATION );
2817 // Test "scrollDomainOffset" property
2818 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET );
2819 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) );
2821 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get<Vector2>(), Vector2(500.0f, 200.0f), TEST_LOCATION );
2823 // Test "scrollPositionDelta" property
2824 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA );
2825 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) );
2827 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get<Vector2>(), Vector2(10.0f, 30.0f), TEST_LOCATION );
2829 // Test "startPagePosition" property
2830 DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION );
2831 scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) );
2833 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get<Vector3>(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION );