2 * Copyright (c) 2020 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-toolkit/dali-toolkit.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
25 using namespace Toolkit;
27 void scroll_view_startup(void)
29 test_return_value = TET_UNDEF;
32 void scroll_view_cleanup(void)
34 test_return_value = TET_PASS;
39 static bool gObjectCreatedCallBackCalled;
41 static void TestCallback(BaseHandle handle)
43 gObjectCreatedCallBackCalled = true;
46 struct CallbackFunctor
48 CallbackFunctor(bool* callbackFlag)
49 : mCallbackFlag( callbackFlag )
55 *mCallbackFlag = true;
60 const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
62 const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
64 // For Clamp Signal testing...
65 const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview
66 const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview
67 const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f); ///< Scroll start position for the Clamping tests.
68 const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
69 const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
70 const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
71 const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value)
72 const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
74 const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); ///< Default overshoot snapping animation time.
75 const float DEFAULT_MAX_OVERSHOOT(100.0f); ///< Default maximum allowed overshoot in pixels
77 const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
78 const Vector2 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f); ///< Scroll start position for the Overshoot tests.
79 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)
80 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).
81 const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
82 const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
83 const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
84 const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
88 * Simulate time passed by.
90 * @note this will always process at least 1 frame (1/60 sec)
92 * @param application Test application instance
93 * @param duration Time to pass in milliseconds.
94 * @return The actual time passed in milliseconds
96 int Wait(ToolkitTestApplication& application, int duration = 0)
100 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
102 application.SendNotification();
103 application.Render(RENDER_FRAME_INTERVAL);
104 time += RENDER_FRAME_INTERVAL;
112 static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
113 static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
114 static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
115 static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
116 static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
117 static Vector3 gConstraintResult; ///< Result from constraint.
120 * Invoked when scrolling starts.
122 * @param[in] position The current scroll position.
124 static void OnScrollStart( const Vector2& position )
126 gOnScrollStartCalled = true;
130 * Invoked when scrolling updates (via dragging)
132 * @param[in] position The current scroll position.
134 static void OnScrollUpdate( const Vector2& position )
136 gOnScrollUpdateCalled = true;
140 * Invoked when scrolling finishes
142 * @param[in] position The current scroll position.
144 static void OnScrollComplete( const Vector2& position )
146 gOnScrollCompleteCalled = true;
150 * Invoked when a snap or flick started.
152 * @param[in] event The type of snap and the target position/scale/rotation.
154 static void OnSnapStart( const ScrollView::SnapEvent& event )
156 gOnSnapStartCalled = true;
157 gLastSnapType = event.type;
163 * Summation of current value, property, and offset.
165 * current' = current + mOffset + property;
167 struct TestSumConstraint
170 * @param[in] offset The offset to be added to current.
172 TestSumConstraint(const Vector3& offset)
178 * @param[in] current The current base value
179 * @param[in] inputs Contains the property to be added to current.
180 * @return The new current Vector.
182 void operator()( Vector3& current, const PropertyInputContainer& inputs )
184 gConstraintResult = current + Vector3(inputs[0]->GetVector2()) + mOffset;
185 current = gConstraintResult;
193 * @param[in] application The application instance
194 * @param[in] scrollView The scrollView instance
195 * @return The time taken for the overshoot to reach origin (zero)
197 static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
199 int timeToReachOrigin = -1;
200 for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
202 float overshootXValue = scrollView.GetCurrentProperty<float>( ScrollView::Property::OVERSHOOT_X );
203 float overshootYValue = scrollView.GetCurrentProperty<float>( ScrollView::Property::OVERSHOOT_Y );
204 if(overshootXValue == 0.0f && overshootYValue == 0.0f)
209 timeToReachOrigin += Wait(application);
212 return static_cast<float>(timeToReachOrigin) * 0.001f; // return in seconds not ms.
216 * y = 2x alpha function, which is clamped between 0.0f - 1.0f
218 * Animations should appear to finish (reach 100% point)
219 * at just half the time of a regular Linear AlphaFunction.
221 * @param[in] progress value (ranges from 0.0f - 1.0f)
222 * @return interpolation value (ranges from 0.0f - 1.0f)
224 float TestAlphaFunction(float progress)
226 return std::min( progress * 2.0f, 1.0f );
230 * Generate a complete pan gesture
231 * Note: To initiate the gesture it will go from start, diagonally SE on the screen, then continue in the direction for frames touches
233 static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t& time, bool finish = true)
235 gOnScrollStartCalled = false;
236 gOnScrollUpdateCalled = false;
237 gOnScrollCompleteCalled = false;
238 gOnSnapStartCalled = false;
240 Vector2 pos( start );
242 // This is created to ensure a pan is started
243 Vector2 pos_start_jump( start + Vector2(11.0f, 11.0f) );
244 TestStartPan( application, start, pos_start_jump, time );
245 pos = pos_start_jump;
249 for(int i = 0;i<frames;i++)
251 pos += direction; // Move in this direction
252 TestMovePan(application, pos, time );
253 time += Wait(application);
258 pos += direction; // Move in this direction.
259 TestEndPan(application, pos, time );
260 time += Wait(application, RENDER_DELAY_SCROLL);
267 } // unnamed namespace
270 int UtcDaliToolkitScrollViewConstructorP(void)
272 ToolkitTestApplication application;
274 ScrollView scrollView;
275 DALI_TEST_CHECK( !scrollView );
279 int UtcDaliToolkitScrollViewCopyConstructorP(void)
281 ToolkitTestApplication application;
283 ScrollView scrollView = ScrollView::New();
284 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
286 ScrollView copy( scrollView );
287 DALI_TEST_CHECK( copy );
288 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
292 int UtcDaliToolkitScrollViewAssignmentOperatorP(void)
294 ToolkitTestApplication application;
296 ScrollView scrollView = ScrollView::New();
297 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
299 ScrollView copy = scrollView;
300 DALI_TEST_CHECK( copy );
301 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
305 int UtcDaliScrollViewDestructorP(void)
307 ToolkitTestApplication application;
309 ScrollView* scrollView = new ScrollView();
312 DALI_TEST_CHECK( true );
316 int UtcDaliToolkitScrollViewNewP1(void)
318 ToolkitTestApplication application;
319 tet_infoline(" UtcDaliToolkitScrollViewNewP1");
321 ScrollView scrollView;
323 DALI_TEST_CHECK( !scrollView );
325 scrollView = ScrollView::New();
327 DALI_TEST_CHECK( scrollView );
329 ScrollView scrollView2(scrollView);
331 DALI_TEST_CHECK( scrollView2 == scrollView );
333 //Additional check to ensure object is created by checking if it's registered
334 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
335 DALI_TEST_CHECK( registry );
337 gObjectCreatedCallBackCalled = false;
338 registry.ObjectCreatedSignal().Connect( &TestCallback );
340 ScrollView scrollView = ScrollView::New();
342 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
346 int UtcDaliToolkitScrollViewNewP2(void)
348 ToolkitTestApplication application;
349 tet_infoline(" UtcDaliToolkitScrollViewNewP2 - create thru type registry");
351 ScrollView scrollView;
352 DALI_TEST_CHECK( !scrollView );
354 TypeRegistry typeRegistry = TypeRegistry::Get();
355 TypeInfo scrollViewType = typeRegistry.GetTypeInfo("ScrollView");
356 BaseHandle handle = scrollViewType.CreateInstance();
357 DALI_TEST_CHECK( handle );
359 scrollView = ScrollView::DownCast(handle);
360 DALI_TEST_CHECK( scrollView );
365 int UtcDaliToolkitScrollViewDownCastP(void)
367 ToolkitTestApplication application;
368 tet_infoline(" UtcDaliToolkitScrollViewDownCastP");
370 ScrollView scrollView = ScrollView::New();
371 BaseHandle handle(scrollView);
373 ScrollView newScrollView = ScrollView::DownCast( handle );
374 DALI_TEST_CHECK( scrollView );
375 DALI_TEST_CHECK( newScrollView == scrollView );
379 int UtcDaliToolkitScrollViewScrollToPositionP(void)
381 ToolkitTestApplication application;
382 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionP");
384 // Create the ScrollView actor
385 ScrollView scrollView = ScrollView::New();
386 application.GetScene().Add( scrollView );
388 const Vector2 target = Vector2(100.0f, 200.0f);
389 const Vector2 target2 = Vector2(300.0f, 100.0f);
391 scrollView.ScrollTo( target, 0.0f );
393 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
394 scrollView.ScrollTo( target2 );
395 Wait(application, RENDER_DELAY_SCROLL);
396 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
401 int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void)
403 ToolkitTestApplication application;
404 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP");
406 ScrollView scrollView = ScrollView::New();
407 application.GetScene().Add( scrollView );
408 RulerPtr rulerX = new FixedRuler( 100.0f );
409 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
410 RulerPtr rulerY = new FixedRuler( 100.0f );
411 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
413 scrollView.SetRulerX( rulerX );
414 scrollView.SetRulerY( rulerY );
416 scrollView.SetWrapMode(true);
418 Property::Value wrapMode = scrollView.GetProperty( Toolkit::ScrollView::Property::WRAP_ENABLED );
419 DALI_TEST_EQUALS( wrapMode.Get<bool>(), true, TEST_LOCATION );
421 const Vector2 target = Vector2(50.0f, 50.0f);
422 const Vector2 target2 = Vector2(150.0f, 150.0f);
424 scrollView.ScrollTo( target, 0.0f );
425 Wait(application, RENDER_DELAY_SCROLL);
426 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
428 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
429 Wait(application, RENDER_DELAY_SCROLL);
430 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
432 scrollView.ScrollTo( target, 0.0f );
433 Wait(application, RENDER_DELAY_SCROLL);
434 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
436 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
437 Wait(application, RENDER_DELAY_SCROLL);
438 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
443 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP(void)
445 ToolkitTestApplication application;
446 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP");
448 // Create the ScrollView actor
449 ScrollView scrollView = ScrollView::New();
450 application.GetScene().Add( scrollView );
452 const Vector2 target = Vector2(100.0f, 200.0f);
453 const Vector2 target2 = Vector2(300.0f, 100.0f);
455 scrollView.ScrollTo( target, 0.5f, TestAlphaFunction );
456 Wait(application, 250);
457 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
458 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
460 scrollView.ScrollTo( target2, 0.5f, AlphaFunction::LINEAR );
461 Wait(application, 250);
462 // Check that the scroll animation has not finished within half of the specified duration with the linear alpha function
463 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition() != target2 );
465 // Wait till the end of the specified duration
466 Wait(application, 250);
467 // Check that the scroll animation has finished
468 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
473 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(void)
475 ToolkitTestApplication application;
476 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP");
478 ScrollView scrollView = ScrollView::New();
479 application.GetScene().Add( scrollView );
480 RulerPtr rulerX = new FixedRuler( 100.0f );
481 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
482 RulerPtr rulerY = new FixedRuler( 100.0f );
483 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
485 scrollView.SetRulerX( rulerX );
486 scrollView.SetRulerY( rulerY );
488 scrollView.SetWrapMode(true);
490 const Vector2 target = Vector2(50.0f, 50.0f);
491 const Vector2 target2 = Vector2(150.0f, 150.0f);
493 scrollView.ScrollTo( target, 0.0f );
494 Wait(application, RENDER_DELAY_SCROLL);
495 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
497 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
498 Wait(application, RENDER_DELAY_SCROLL);
499 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
501 scrollView.ScrollTo( target, 0.0f );
502 Wait(application, RENDER_DELAY_SCROLL);
503 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
505 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
506 Wait(application, RENDER_DELAY_SCROLL);
507 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
509 scrollView.ScrollTo( target, 0.0f );
510 Wait(application, RENDER_DELAY_SCROLL);
511 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
513 scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
514 Wait(application, 125);
515 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
516 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
521 int UtcDaliToolkitScrollViewScrollToPageP(void)
523 ToolkitTestApplication application;
524 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageP");
526 ScrollView scrollView = ScrollView::New();
527 application.GetScene().Add( scrollView );
528 RulerPtr rulerX = new FixedRuler( 100.0f );
529 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
530 RulerPtr rulerY = new FixedRuler( 100.0f );
531 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
533 scrollView.SetRulerX( rulerX );
534 scrollView.SetRulerY( rulerY );
536 scrollView.ScrollTo( 1, 0.0f );
538 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
540 scrollView.ScrollTo( 5, 0.0f );
542 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(500.0f, 0.0f), TEST_LOCATION );
544 scrollView.ScrollTo( 10, 0.0f );
546 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 100.0f), TEST_LOCATION );
548 scrollView.ScrollTo( 15, 0.0f );
550 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(700.0f, 100.0f), TEST_LOCATION );
551 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
553 scrollView.ScrollTo( 3 );
554 Wait(application, RENDER_DELAY_SCROLL);
555 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(300.0f, 0.0f), TEST_LOCATION );
556 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
558 scrollView.ScrollTo( 9 );
559 Wait(application, RENDER_DELAY_SCROLL);
560 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 100.0f), TEST_LOCATION );
561 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
563 // Apply DefaultRulers instead and see what happens.
564 rulerX = new DefaultRuler();
565 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
566 rulerY = new DefaultRuler();
567 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
569 scrollView.SetRulerX( rulerX );
570 scrollView.SetRulerY( rulerY );
572 // This time should always scroll to origin (0.0f, 0.0f)
573 scrollView.ScrollTo( 1, 0.0f );
575 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
576 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
582 int UtcDaliToolkitScrollModeP1(void)
584 ToolkitTestApplication application;
585 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
587 // Set up a scrollView.
588 ScrollView scrollView = ScrollView::New();
590 // Do not rely on stage size for UTC tests.
591 Vector2 viewPageSize( 720.0f, 1280.0f );
592 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
593 scrollView.SetProperty( Actor::Property::SIZE, viewPageSize );
594 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
595 scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
596 scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
599 Property::Map rulerMap;
600 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
601 rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, viewPageSize.width );
602 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, viewPageSize.width*3 );
603 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, false );
604 scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
606 scrollView.SetWrapMode( false );
607 scrollView.SetScrollSensitive( true );
609 application.GetScene().Add( scrollView );
611 // Set up a gesture to perform.
612 Vector2 startPos( 50.0f, 0.0f );
613 Vector2 direction( -5.0f, 0.0f );
617 // Force starting position.
618 scrollView.ScrollTo( startPos, 0.0f );
619 time += Wait( application );
621 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
622 Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
624 // Confirm the final X coord has not moved more than one page from the start X position.
625 DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
627 // Finish the gesture and wait for the snap.
628 currentPos += direction;
629 TestEndPan( application, currentPos, time );
630 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
631 time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
633 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
634 DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
639 int UtcDaliToolkitScrollModeP2(void)
641 ToolkitTestApplication application;
642 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
644 // Set up a scrollView.
645 ScrollView scrollView = ScrollView::New();
647 // Do not rely on stage size for UTC tests.
648 Vector2 viewPageSize( 720.0f, 1280.0f );
649 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
650 scrollView.SetProperty( Actor::Property::SIZE, viewPageSize );
651 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
652 scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
653 scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
656 Property::Map rulerMap;
657 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
658 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
659 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height );
660 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 );
661 scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
663 scrollView.SetWrapMode( false );
664 scrollView.SetScrollSensitive( true );
666 application.GetScene().Add( scrollView );
668 // Set up a gesture to perform.
669 Vector2 startPos( 0.0f, 50.0f );
670 Vector2 direction( 0.0f, -6.0f );
674 // Force starting position.
675 scrollView.ScrollTo( startPos, 0.0f );
676 time += Wait( application );
678 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
679 Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
681 // Confirm the final X coord has not moved more than one page from the start X position.
682 DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
684 // Finish the gesture and wait for the snap.
685 currentPos += direction;
686 time += Wait( application );
687 TestEndPan( application, currentPos, time );
688 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
689 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
691 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
692 DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
697 int UtcDaliToolkitScrollModeP3(void)
699 ToolkitTestApplication application;
700 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
702 // Set up a scrollView.
703 ScrollView scrollView = ScrollView::New();
705 // Do not rely on stage size for UTC tests.
706 Vector2 viewPageSize( 720.0f, 1280.0f );
707 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
708 scrollView.SetProperty( Actor::Property::SIZE, viewPageSize );
709 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
710 scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
711 scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
714 Property::Map rulerMap;
715 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
716 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
717 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height );
718 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 );
719 scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
721 scrollView.SetWrapMode( false );
722 scrollView.SetScrollSensitive( true );
724 application.GetScene().Add( scrollView );
726 // Set up a gesture to perform.
727 Vector2 startPos( 0.0f, 50.0f );
728 Vector2 direction( 0.0f, -6.0f );
732 // Force starting position.
733 scrollView.ScrollTo( startPos, 0.0f );
734 time += Wait( application );
736 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
737 Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
739 // Confirm the final X coord has not moved more than one page from the start X position.
740 DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
742 // Finish the gesture and wait for the snap.
743 currentPos += direction;
744 TestEndPan( application, currentPos, time );
745 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
746 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
748 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
749 DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
754 int UtcDaliToolkitScrollModeP4(void)
756 ToolkitTestApplication application;
757 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property, DefaultRulers" );
759 // Set up a scrollView.
760 ScrollView scrollView = ScrollView::New();
762 // Do not rely on stage size for UTC tests.
763 Vector2 viewPageSize( 720.0f, 1280.0f );
764 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
765 scrollView.SetProperty( Actor::Property::SIZE, viewPageSize );
766 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
767 scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
768 scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
770 // Position rulers - expect Default rulers to be used which don't snap
771 Property::Map rulerMap;
772 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
773 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
774 scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
776 scrollView.SetWrapMode( false );
777 scrollView.SetScrollSensitive( true );
779 application.GetScene().Add( scrollView );
781 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
784 scrollView.ScrollTo(START_POSITION, 0.0f);
785 time += Wait(application);
787 // Try a vertical swipe.
788 // PerformGestureSwipe not used as a different initial direction was required
789 Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
790 Vector2 dir( 0.0f, 1.0f );
792 TestStartPan( application, START_POSITION, pos, time );
796 for( int i = 0; i<45; i++ )
799 TestMovePan( application, pos, time );
800 time += Wait( application );
805 TestEndPan( application, pos, time );
806 Wait( application, RENDER_DELAY_SCROLL );
808 // Take into account resampling done when prediction is off.
809 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
814 int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void)
816 ToolkitTestApplication application;
817 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP");
819 ScrollView scrollView = ScrollView::New();
820 application.GetScene().Add( scrollView );
821 RulerPtr rulerX = new FixedRuler( 100.0f );
822 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
823 RulerPtr rulerY = new FixedRuler( 100.0f );
824 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
826 scrollView.SetRulerX( rulerX );
827 scrollView.SetRulerY( rulerY );
829 scrollView.SetWrapMode(true);
831 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasLeft );
833 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
834 // Check that the scroll position remains the same
835 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
837 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
838 // Check that it stays at the same page (i.e. the same scroll position)
839 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
840 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
842 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasRight );
844 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
845 // Check that it scrolls towards the right
846 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition().x > 0.0f );
848 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
849 // Check that it scrolls back to the same page (i.e. the same scroll position)
850 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
851 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
856 int UtcDaliToolkitScrollViewScrollToActorP(void)
858 ToolkitTestApplication application;
859 tet_infoline(" UtcDaliToolkitScrollViewScrollToActorP");
861 ScrollView scrollView = ScrollView::New();
862 application.GetScene().Add( scrollView );
864 Actor actorA = Actor::New();
865 const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f);
866 actorA.SetProperty( Actor::Property::POSITION, positionA );
867 scrollView.Add(actorA);
869 Actor actorB = Actor::New();
870 const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f);
871 actorB.SetProperty( Actor::Property::POSITION, positionB );
872 scrollView.Add(actorB);
876 scrollView.ScrollTo(actorA, 0.0f);
878 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
881 scrollView.ScrollTo(actorB, 0.0f);
883 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
885 scrollView.ScrollTo(actorA);
886 Wait(application, RENDER_DELAY_SCROLL);
887 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
889 scrollView.ScrollTo(actorB);
890 Wait(application, RENDER_DELAY_SCROLL);
891 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
895 int UtcDaliToolkitScrollViewScrollToSnapPointP(void)
897 ToolkitTestApplication application;
898 tet_infoline(" UtcDaliToolkitScrollViewScrollToSnapPointP");
900 ScrollView scrollView = ScrollView::New();
901 application.GetScene().Add( scrollView );
902 RulerPtr rulerX = new FixedRuler( 100.0f );
903 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
904 RulerPtr rulerY = new FixedRuler( 100.0f );
905 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
907 scrollView.SetRulerX( rulerX );
908 scrollView.SetRulerY( rulerY );
910 scrollView.ScrollTo( Vector2(120.0f, 190.0f), 0.0f );
912 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(120.0f, 190.0f), TEST_LOCATION );
914 scrollView.ScrollToSnapPoint();
916 Wait(application, RENDER_DELAY_SCROLL);
917 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 200.0f), TEST_LOCATION );
921 int UtcDaliToolkitScrollViewSetScrollUpdateDistanceP(void)
923 ToolkitTestApplication application;
924 tet_infoline(" UtcDaliToolkitScrollViewSetScrollUpdateDistanceP");
926 ScrollView scrollView = ScrollView::New();
928 scrollView.SetScrollUpdateDistance(0);
929 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 0, TEST_LOCATION);
930 scrollView.SetScrollUpdateDistance(10);
931 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 10, TEST_LOCATION);
932 scrollView.SetScrollUpdateDistance(1000);
933 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 1000, TEST_LOCATION);
937 int UtcDaliToolkitScrollViewSetWrapModeP(void)
939 ToolkitTestApplication application;
940 tet_infoline(" UtcDaliToolkitScrollViewSetWrapModeP");
942 ScrollView scrollView = ScrollView::New();
943 application.GetScene().Add( scrollView );
945 Actor actor = Actor::New();
946 scrollView.Add( actor );
948 // Position rulers. 4x4 grid.
949 RulerPtr rulerX = new FixedRuler(50.0f);
950 RulerPtr rulerY = new FixedRuler(50.0f);
951 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) );
952 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) );
953 scrollView.SetRulerX(rulerX);
954 scrollView.SetRulerY(rulerY);
956 scrollView.SetWrapMode(false);
957 scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
959 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
961 scrollView.SetWrapMode(true);
962 scrollView.ScrollTo(Vector2(230.0f, 130.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
964 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 13, TEST_LOCATION );
968 int UtcDaliToolkitScrollViewActorAutoSnap(void)
970 ToolkitTestApplication application;
971 tet_infoline(" UtcDaliToolkitScrollViewActorAutoSnap");
973 ScrollView scrollView = ScrollView::New();
974 application.GetScene().Add( scrollView );
977 RulerPtr rulerX = new DefaultRuler();
978 RulerPtr rulerY = new DefaultRuler();
979 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
980 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
981 scrollView.SetRulerX(rulerX);
982 scrollView.SetRulerY(rulerY);
984 const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f);
985 Actor a = Actor::New();
987 a.SetProperty( Actor::Property::POSITION, aPosition );
989 const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f);
990 Actor b = Actor::New();
992 b.SetProperty( Actor::Property::POSITION, bPosition );
994 // Goto a random position, and execute snap (should not move)
995 Vector2 targetScroll = Vector2(500.0f, 500.0f);
996 scrollView.ScrollTo(targetScroll, 0.0f);
998 scrollView.ScrollToSnapPoint();
999 Wait(application, RENDER_DELAY_SCROLL);
1000 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION );
1002 // Enable ActorAutoSnap, and now try snapping.
1003 scrollView.SetActorAutoSnap(true);
1004 scrollView.ScrollToSnapPoint();
1005 Wait(application, RENDER_DELAY_SCROLL);
1006 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition.GetVectorXY(), TEST_LOCATION );
1008 scrollView.ScrollTo(Vector2(0.0f, 0.0f), 0.0f);
1010 scrollView.ScrollToSnapPoint();
1011 Wait(application, RENDER_DELAY_SCROLL);
1012 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition.GetVectorXY(), TEST_LOCATION );
1016 int UtcDaliToolkitScrollViewSignalsStartComplete(void)
1018 ToolkitTestApplication application;
1019 tet_infoline(" UtcDaliToolkitScrollViewSignalsStartComplete");
1021 gOnScrollStartCalled = false;
1022 gOnScrollCompleteCalled = false;
1024 ScrollView scrollView = ScrollView::New();
1025 application.GetScene().Add( scrollView );
1028 RulerPtr rulerX = new DefaultRuler();
1029 RulerPtr rulerY = new DefaultRuler();
1030 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1031 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1032 scrollView.SetRulerX(rulerX);
1033 scrollView.SetRulerY(rulerY);
1034 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1035 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1036 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1037 scrollView.ScrollTo( Vector2(100.0f, 100.0f) );
1038 Wait(application, RENDER_DELAY_SCROLL);
1040 DALI_TEST_CHECK(gOnScrollStartCalled);
1041 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1045 int UtcDaliToolkitScrollViewSignalsUpdate01(void)
1047 ToolkitTestApplication application;
1048 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1050 gOnScrollStartCalled = false;
1051 gOnScrollUpdateCalled = false;
1052 gOnScrollCompleteCalled = false;
1054 ScrollView scrollView = ScrollView::New();
1055 application.GetScene().Add( scrollView );
1056 Vector2 stageSize = application.GetScene().GetSize();
1057 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1058 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1059 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1062 RulerPtr rulerX = new DefaultRuler();
1063 RulerPtr rulerY = new DefaultRuler();
1064 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1065 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1066 scrollView.SetRulerX(rulerX);
1067 scrollView.SetRulerY(rulerY);
1068 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1069 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1070 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1072 Actor image = Actor::New();
1073 image.SetProperty( Actor::Property::SIZE, stageSize);
1074 image.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1075 image.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1076 scrollView.Add(image);
1080 // Do a pan starting from 100,100 and moving down diagonally.
1081 Vector2 pos(100.0f, 100.0f);
1082 uint32_t time = 100;
1083 TestStartPan( application, pos, pos, time );
1086 Wait(application, 100);
1088 for(int i = 0;i<20;i++)
1090 time += RENDER_FRAME_INTERVAL;
1091 TestMovePan( application, pos, time);
1097 time += RENDER_FRAME_INTERVAL;
1098 TestEndPan(application, pos, time );
1099 Wait(application, RENDER_DELAY_SCROLL);
1101 DALI_TEST_CHECK(gOnScrollStartCalled);
1102 DALI_TEST_CHECK(gOnScrollUpdateCalled);
1103 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1107 int UtcDaliToolkitScrollViewSignalsUpdate02(void)
1109 ToolkitTestApplication application;
1110 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1112 gOnScrollStartCalled = false;
1113 gOnScrollUpdateCalled = false;
1114 gOnScrollCompleteCalled = false;
1116 ScrollView scrollView = ScrollView::New();
1117 application.GetScene().Add( scrollView );
1118 Vector2 stageSize = application.GetScene().GetSize();
1119 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1120 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1121 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1124 RulerPtr rulerX = new DefaultRuler();
1125 RulerPtr rulerY = new DefaultRuler();
1126 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1127 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1128 scrollView.SetRulerX(rulerX);
1129 scrollView.SetRulerY(rulerY);
1130 Dali::ConnectionTracker tracker;
1131 bool scrollStarted=false;
1132 bool scrollUpdated=false;
1133 bool scrollCompleted=false;
1134 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) ));
1135 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) ));
1136 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) ));
1138 Actor image = Actor::New();
1139 image.SetProperty( Actor::Property::SIZE, stageSize);
1140 image.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1141 image.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1142 scrollView.Add(image);
1146 // Do a pan starting from 100,100 and moving down diagonally.
1147 Vector2 pos(100.0f, 100.0f);
1148 uint32_t time = 100;
1149 TestStartPan( application, pos, pos, time );
1152 Wait(application, 100);
1154 for(int i = 0;i<20;i++)
1156 time += RENDER_FRAME_INTERVAL;
1157 TestMovePan( application, pos, time);
1163 time += RENDER_FRAME_INTERVAL;
1164 TestEndPan(application, pos, time );
1165 Wait(application, RENDER_DELAY_SCROLL);
1167 DALI_TEST_CHECK(scrollStarted);
1168 DALI_TEST_CHECK(scrollUpdated);
1169 DALI_TEST_CHECK(scrollCompleted);
1171 application.GetScene().Remove( scrollView );
1176 int UtcDaliToolkitScrollViewScrollSensitive(void)
1178 ToolkitTestApplication application;
1179 tet_infoline(" UtcDaliToolkitScrollViewScrollSensitive");
1181 // Set up a scrollView...
1182 ScrollView scrollView = ScrollView::New();
1183 scrollView.SetOvershootEnabled(true);
1184 application.GetScene().Add( scrollView );
1185 Vector2 stageSize = application.GetScene().GetSize();
1186 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1187 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1188 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1191 RulerPtr rulerX = new DefaultRuler();
1192 RulerPtr rulerY = new DefaultRuler();
1193 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1194 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1195 scrollView.SetRulerX(rulerX);
1196 scrollView.SetRulerY(rulerY);
1197 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1198 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1199 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1200 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1202 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1204 time +=Wait(application);
1206 // First try insensitive swipe.
1207 scrollView.SetScrollSensitive(false);
1208 PerformGestureSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, time, true);
1210 DALI_TEST_CHECK( !gOnScrollStartCalled );
1211 DALI_TEST_CHECK( !gOnScrollCompleteCalled );
1212 DALI_TEST_CHECK( !gOnSnapStartCalled );
1214 // Second try sensitive swipe.
1215 scrollView.SetScrollSensitive(true);
1216 PerformGestureSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, time, true);
1218 DALI_TEST_CHECK( gOnScrollStartCalled );
1219 DALI_TEST_CHECK( gOnScrollCompleteCalled );
1220 DALI_TEST_CHECK( gOnSnapStartCalled );
1224 int UtcDaliToolkitScrollViewAxisAutoLock(void)
1226 ToolkitTestApplication application;
1227 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLock");
1229 // Set up a scrollView...
1230 ScrollView scrollView = ScrollView::New();
1231 application.GetScene().Add( scrollView );
1232 Vector2 stageSize = application.GetScene().GetSize();
1233 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1234 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1235 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1238 RulerPtr rulerX = new DefaultRuler();
1239 RulerPtr rulerY = new DefaultRuler();
1240 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1241 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1242 scrollView.SetRulerX(rulerX);
1243 scrollView.SetRulerY(rulerY);
1244 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1245 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1246 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1249 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1251 time += Wait(application);
1253 Vector2 startPosition = scrollView.GetCurrentScrollPosition();
1254 Vector2 dir(5.0f, 1.0f);
1256 // PerformGestureSwipe not used as a different initial direction was required
1258 Vector2 pos( CLAMP_TOUCH_START + Vector2(15.0f, 3.0f) );
1260 TestStartPan( application, CLAMP_TOUCH_START, pos, time );
1262 time += Wait(application);
1264 for( int i = 0; i<47; i++ )
1267 TestMovePan( application, pos, time );
1268 time += Wait( application );
1273 TestEndPan( application, pos, time );
1275 const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
1278 scrollView.SetAxisAutoLock(true);
1279 DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
1281 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1282 time += Wait(application);
1284 Vector2 pos2( CLAMP_TOUCH_START + Vector2(15.0f, 3.0f) );
1286 TestStartPan( application, CLAMP_TOUCH_START, pos2, time );
1288 time += Wait(application);
1290 for( int i = 0; i<47; i++ )
1293 TestMovePan( application, pos2, time );
1294 time += Wait( application );
1299 TestEndPan( application, pos2, time );
1301 const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
1303 // compare how much the Y position has deviated for normal and autolock.
1304 const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
1305 const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
1307 // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
1308 DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
1310 scrollView.SetAxisAutoLock(false);
1311 DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
1315 int UtcDaliToolkitScrollViewAxisAutoLockGradient(void)
1317 ToolkitTestApplication application;
1318 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLockGradient");
1320 // Set up a scrollView...
1321 ScrollView scrollView = ScrollView::New();
1322 scrollView.SetAxisAutoLockGradient(0.5f);
1323 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
1324 scrollView.SetAxisAutoLockGradient(1.0f);
1325 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
1329 int UtcDaliToolkitScrollViewConstraints(void)
1331 ToolkitTestApplication application;
1332 tet_infoline(" UtcDaliToolkitScrollViewConstraints");
1334 // Set up a scrollView...
1335 ScrollView scrollView = ScrollView::New();
1336 application.GetScene().Add( scrollView );
1337 Vector2 stageSize = application.GetScene().GetSize();
1338 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1339 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1340 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1343 RulerPtr rulerX = new DefaultRuler();
1344 RulerPtr rulerY = new DefaultRuler();
1345 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1346 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1347 scrollView.SetRulerX(rulerX);
1348 scrollView.SetRulerY(rulerY);
1350 // Add an Actor to ScrollView,
1351 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1352 gConstraintResult = Vector3::ZERO;
1353 Actor a = Actor::New();
1355 a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION);
1358 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1359 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1360 constraint.SetRemoveAction(Constraint::Discard);
1361 scrollView.ApplyConstraintToChildren(constraint);
1364 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1366 gConstraintResult = Vector3::ZERO;
1367 scrollView.RemoveConstraintsFromChildren();
1370 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1374 int UtcDaliToolkitScrollViewBind(void)
1376 ToolkitTestApplication application;
1377 tet_infoline(" UtcDaliToolkitScrollViewBind");
1379 // Set up a scrollView...
1380 ScrollView scrollView = ScrollView::New();
1381 application.GetScene().Add( scrollView );
1382 Vector2 stageSize = application.GetScene().GetSize();
1383 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1384 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1385 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1388 RulerPtr rulerX = new DefaultRuler();
1389 RulerPtr rulerY = new DefaultRuler();
1390 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1391 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1392 scrollView.SetRulerX(rulerX);
1393 scrollView.SetRulerY(rulerY);
1395 // Add an Actor to ScrollView,
1396 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1398 gConstraintResult = Vector3::ZERO;
1399 Actor a = Actor::New();
1401 a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION);
1404 // apply this constraint to scrollview
1405 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1406 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1407 constraint.SetRemoveAction(Constraint::Discard);
1408 scrollView.ApplyConstraintToChildren(constraint);
1412 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1415 gConstraintResult = Vector3::ZERO;
1416 scrollView.UnbindActor( a );
1418 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1421 gConstraintResult = Vector3::ZERO;
1422 scrollView.BindActor( a );
1424 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1428 int UtcDaliToolkitScrollViewOvershoot(void)
1430 ToolkitTestApplication application;
1431 tet_infoline(" UtcDaliToolkitScrollViewOvershoot");
1433 // Set up a scrollView...
1434 ScrollView scrollView = ScrollView::New();
1435 scrollView.SetOvershootEnabled(true);
1438 Vector2 overshootSize = Vector2(100.0f,100.0f);
1439 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
1440 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
1442 application.GetScene().Add( scrollView );
1443 Vector2 stageSize = application.GetScene().GetSize();
1444 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1445 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1446 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1449 RulerPtr rulerX = new DefaultRuler();
1450 RulerPtr rulerY = new DefaultRuler();
1451 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1452 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1453 scrollView.SetRulerX(rulerX);
1454 scrollView.SetRulerY(rulerY);
1455 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1456 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1457 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1459 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1460 time += Wait(application);
1462 // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
1463 Vector2 currentPos = Vector2(100.0f, 100.0f);
1464 currentPos = PerformGestureSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, time, false);
1465 float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1466 float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1467 Vector2 positionValue = scrollView.GetCurrentProperty< Vector2 >( ScrollView::Property::SCROLL_POSITION );
1468 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1469 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1470 DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION);
1472 float timeToReachOrigin;
1474 // Now release touch. Overshoot should snap back to zero.
1475 TestEndPan(application, currentPos, time);
1477 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1479 float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1480 float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1482 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1483 (timeToReachOrigin < maxTimeToReachOrigin) );
1485 // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
1486 scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
1488 currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
1489 // Now release touch. Overshoot should snap back to zero.
1490 TestEndPan(application, currentPos, time);
1491 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1493 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1494 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1496 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1497 (timeToReachOrigin < maxTimeToReachOrigin) );
1499 // 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
1500 scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
1502 currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
1503 // Now release touch. Overshoot should snap back to zero.
1504 TestEndPan(application, currentPos, time);
1505 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1507 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1508 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1510 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1511 (timeToReachOrigin < maxTimeToReachOrigin) );
1513 // 4. Repeat Scroll, but this time change overshoot function.
1514 scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
1515 scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
1517 currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false);
1518 // Now release touch. Overshoot should snap back to zero.
1519 TestEndPan(application, currentPos, time);
1520 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1522 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1523 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1525 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1526 (timeToReachOrigin < maxTimeToReachOrigin) );
1530 int UtcDaliToolkitScrollViewSnapAlphaFunction(void)
1532 ToolkitTestApplication application;
1533 tet_infoline(" UtcDaliToolkitScrollViewSnapAlphaFunction");
1535 // Set up a scrollView...
1536 ScrollView scrollView = ScrollView::New();
1537 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_IN );
1538 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_IN );
1539 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_OUT );
1540 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_OUT );
1542 scrollView.SetScrollFlickAlphaFunction( AlphaFunction::BOUNCE );
1543 DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction().GetBuiltinFunction() == AlphaFunction::BOUNCE );
1548 int UtcDaliToolkitScrollViewSnapDuration(void)
1550 ToolkitTestApplication application;
1551 tet_infoline(" UtcDaliToolkitScrollViewSnapDuration");
1553 // Set up a scrollView...
1554 ScrollView scrollView = ScrollView::New();
1555 scrollView.SetScrollSnapDuration( 1.0f );
1556 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION );
1557 scrollView.SetScrollSnapDuration( 0.5f );
1558 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION );
1560 scrollView.SetScrollFlickDuration( 2.0f );
1561 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION );
1562 scrollView.SetScrollFlickDuration( 1.5f );
1563 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION );
1567 int UtcDaliToolkitScrollViewSnapStartedSignalP(void)
1569 ToolkitTestApplication application;
1570 tet_infoline(" UtcDaliToolkitScrollViewSnapStartedSignalP");
1572 // Set up a scrollView...
1573 ScrollView scrollView = ScrollView::New();
1574 application.GetScene().Add( scrollView );
1575 Vector2 stageSize = application.GetScene().GetSize();
1576 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1577 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1578 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1581 RulerPtr rulerX = new DefaultRuler();
1582 RulerPtr rulerY = new DefaultRuler();
1583 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1584 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1585 scrollView.SetRulerX(rulerX);
1586 scrollView.SetRulerY(rulerY);
1587 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1589 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1591 time += Wait(application);
1593 // First try a snap.
1594 PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, time, true);
1596 DALI_TEST_CHECK( gOnSnapStartCalled );
1597 DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
1599 // Second try a swipe.
1600 PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, time, true);
1602 DALI_TEST_CHECK( gOnSnapStartCalled );
1603 DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
1607 int UtcDaliToolkitScrollViewGetCurrentPageP(void)
1609 ToolkitTestApplication application;
1610 tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP");
1612 ScrollView scrollView = ScrollView::New();
1613 application.GetScene().Add( scrollView );
1614 RulerPtr rulerX = new FixedRuler( 100.0f );
1615 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1616 RulerPtr rulerY = new FixedRuler( 100.0f );
1617 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1619 scrollView.SetRulerX( rulerX );
1620 scrollView.SetRulerY( rulerY );
1622 scrollView.ScrollTo( 15 );
1623 Wait(application, RENDER_DELAY_SCROLL);
1624 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
1626 scrollView.ScrollTo( 3 );
1627 Wait(application, RENDER_DELAY_SCROLL);
1628 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
1630 scrollView.ScrollTo( 9 );
1631 Wait(application, RENDER_DELAY_SCROLL);
1632 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
1637 int UtcDaliToolkitScrollViewSetMaxOvershootP(void)
1639 ToolkitTestApplication application;
1640 tet_infoline(" UtcDaliToolkitScrollViewSetMaxOvershootP");
1642 // Set up a scrollView...
1643 ScrollView scrollView = ScrollView::New();
1644 application.GetScene().Add( scrollView );
1645 Vector2 stageSize = application.GetScene().GetSize();
1646 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1647 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1648 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1651 RulerPtr rulerX = new DefaultRuler();
1652 RulerPtr rulerY = new DefaultRuler();
1653 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1654 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1655 scrollView.SetRulerX(rulerX);
1656 scrollView.SetRulerY(rulerY);
1658 // Set the max overshoot to be 50 pixels in both X axis and Y axis
1659 scrollView.SetMaxOvershoot(50.0f, 50.0f);
1661 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1663 time += Wait(application);
1665 // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
1666 Vector2 currentPos = PerformGestureSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 10, time, false);
1667 float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1668 float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1669 DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
1670 DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
1672 time += Wait(application);
1673 // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
1674 for(int i = 0; i<106; i++)
1676 TestMovePan(application, currentPos, time );
1677 currentPos += Vector2(1.0f, 1.0f);
1678 time += Wait(application);
1681 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1682 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1683 // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
1684 // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
1685 float correctOvershootValue = 0.508f; // This was measured and then set as the limit
1686 DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1687 DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1689 // Scroll page further in NW (-25,-25 pixels), then check that overshoot should be now 1.0. (don't release touch)
1690 for(int i = 0;i<25;i++)
1692 TestMovePan(application, currentPos, time );
1693 currentPos += Vector2(1.0f, 1.0f); // Move in this direction
1694 time += Wait(application);
1697 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1698 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1699 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1700 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1702 // Change the max overshoot to be 250 pixels in both X axis and Y axis
1703 scrollView.SetMaxOvershoot(250.0f, 250.0f);
1704 time += Wait(application);
1706 // Check that overshoot should be now around 0.8.
1707 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1708 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1709 DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
1710 DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
1712 // Scroll page further in NW (-50,-50 pixels), then check that overshoot should be now 1.0. (don't release touch)
1713 for(int i = 0;i<50;i++)
1715 TestMovePan(application, currentPos, time );
1716 currentPos += Vector2(1.0f, 1.0f); // Move in this direction
1717 time += Wait(application);
1720 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1721 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1722 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1723 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1728 int UtcDaliToolkitScrollViewSetScrollingDirectionP(void)
1730 ToolkitTestApplication application;
1731 tet_infoline(" UtcDaliToolkitScrollViewSetScrollingDirectionP");
1733 // Set up a scrollView...
1734 ScrollView scrollView = ScrollView::New();
1735 application.GetScene().Add( scrollView );
1736 Vector2 stageSize = application.GetScene().GetSize();
1737 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1738 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1739 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1741 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1743 scrollView.ScrollTo(START_POSITION, 0.0f);
1745 time += Wait(application);
1747 // Try a vertical swipe.
1748 // PerformGestureSwipe not used as a different initial direction was required
1750 Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
1751 TestStartPan( application, START_POSITION, pos, time );
1752 time += Wait(application);
1753 for( int i = 0; i<45; i++ )
1755 pos += Vector2(0.0f, 1.0f);
1756 TestMovePan( application, pos, time );
1757 time += Wait( application );
1759 pos += Vector2(0.0f, 1.0f);
1760 TestEndPan( application, pos, time );
1761 time += Wait( application );
1763 // Take into account resampling done when prediction is off.
1764 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1766 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1768 scrollView.ScrollTo(START_POSITION, 0.0f);
1769 time += Wait(application);
1771 // Try a vertical swipe.
1772 // PerformGestureSwipe not used as a different initial direction was required
1773 pos = ( START_POSITION + Vector2(0.0f, 15.0f) );
1774 TestStartPan( application, START_POSITION, pos, time );
1775 time += Wait(application);
1776 for( int i = 0; i<45; i++ )
1778 pos += Vector2(0.0f, 1.0f);
1779 TestMovePan( application, pos, time );
1780 time += Wait( application );
1782 pos += Vector2(0.0f, 1.0f);
1783 TestEndPan( application, pos, time );
1784 time += Wait( application );
1786 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1788 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1790 scrollView.ScrollTo(START_POSITION, 0.0f);
1792 time += Wait(application);
1794 // Try a vertical swipe.
1795 // PerformGestureSwipe not used as a different initial direction was required
1796 pos = ( START_POSITION + Vector2(0.0f, 15.0f) );
1797 TestStartPan( application, START_POSITION, pos, time );
1798 time += Wait(application);
1799 for( int i = 0; i<45; i++ )
1801 pos += Vector2(0.0f, 1.0f);
1802 TestMovePan( application, pos, time );
1803 time += Wait( application );
1805 pos += Vector2(0.0f, 1.0f);
1806 TestEndPan( application, pos, time );
1807 time += Wait( application );
1809 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1814 int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void)
1816 ToolkitTestApplication application;
1817 tet_infoline(" UtcDaliToolkitScrollViewRemoveScrollingDirectionP");
1819 // Set up a scrollView...
1820 ScrollView scrollView = ScrollView::New();
1821 application.GetScene().Add( scrollView );
1822 Vector2 stageSize = application.GetScene().GetSize();
1823 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
1824 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
1825 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
1827 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1830 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1832 scrollView.ScrollTo(START_POSITION, 0.0f);
1834 time += Wait(application);
1836 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1838 // Try a vertical swipe.
1839 // PerformGestureSwipe not used as a different initial direction was required
1840 Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) );
1841 TestStartPan( application, START_POSITION, pos, time );
1842 time += Wait(application);
1843 for( int i = 0; i<45; i++ )
1845 pos += Vector2(0.0f, 1.0f);
1846 TestMovePan( application, pos, time );
1847 time += Wait( application );
1849 pos += Vector2(0.0f, 1.0f);
1850 TestEndPan( application, pos, time );
1851 time += Wait( application );
1853 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1855 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1856 // When the horizontal direction is removed, there are no directions set and therefore all will work
1857 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_HORIZONTAL);
1859 time += Wait(application);
1860 // Try a vertical swipe.
1861 Vector2 pos2( pos + Vector2(0.0f, 15.0f) );
1862 TestStartPan( application, pos, pos2, time );
1863 time += Wait(application);
1864 for( int i = 0; i<45; i++ )
1866 pos2 += Vector2(0.0f, 1.0f);
1867 TestMovePan( application, pos2, time );
1868 time += Wait( application );
1870 pos2 += Vector2(0.0f, 1.0f);
1871 TestEndPan( application, pos2, time );
1873 // The previous scroll should not have had any effect
1874 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1879 int UtcDaliToolkitScrollViewSetRulerXP(void)
1881 ToolkitTestApplication application;
1882 tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP");
1884 ScrollView scrollView = ScrollView::New();
1885 application.GetScene().Add( scrollView );
1886 RulerPtr rulerX = new FixedRuler( 100.0f );
1887 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1889 scrollView.SetRulerX( rulerX );
1891 scrollView.ScrollTo( 1, 0.0f );
1893 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
1895 RulerPtr newRulerX = new FixedRuler( 200.0f );
1896 newRulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1898 scrollView.SetRulerX( newRulerX );
1900 scrollView.ScrollTo( 1, 0.0f );
1902 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 0.0f), TEST_LOCATION );
1907 int UtcDaliToolkitScrollViewSetRulerYP(void)
1909 ToolkitTestApplication application;
1910 tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP");
1912 ScrollView scrollView = ScrollView::New();
1913 application.GetScene().Add( scrollView );
1915 RulerPtr rulerY = new FixedRuler( 200.0f );
1916 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1918 scrollView.SetRulerY( rulerY );
1920 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1922 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 350.0f), TEST_LOCATION );
1924 RulerPtr newRulerY = new FixedRuler( 100.0f );
1925 newRulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
1926 scrollView.SetRulerY( newRulerY );
1928 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1930 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 200.0f), TEST_LOCATION );
1935 int UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP(void)
1937 ToolkitTestApplication application;
1938 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP");
1940 ScrollView scrollView = ScrollView::New();
1941 scrollView.SetMinimumSpeedForFlick(25.0f);
1942 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 25.0f, TEST_LOCATION );
1943 scrollView.SetMinimumSpeedForFlick(60.0f);
1944 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 60.0f, TEST_LOCATION );
1948 int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void)
1950 ToolkitTestApplication application;
1951 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumDistanceForFlick");
1953 ScrollView scrollView = ScrollView::New();
1955 scrollView.SetMinimumDistanceForFlick(Vector2(30.0f, 15.0f));
1956 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1957 scrollView.SetMinimumDistanceForFlick(Vector2(60.0f, 30.0f));
1958 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1962 int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void)
1964 ToolkitTestApplication application;
1965 tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP");
1967 ScrollView scrollView = ScrollView::New();
1968 // Disable Refresh signal (TET environment cannot use adaptor's Timer)
1969 scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
1970 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1971 scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
1972 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1976 int UtcDaliToolkitScrollViewApplyEffectP(void)
1978 ToolkitTestApplication application;
1979 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectP");
1981 // Create a ScrollView
1982 ScrollView scrollView = ScrollView::New();
1984 // Create two scroll view effects
1985 Dali::Path path = Dali::Path::New();
1986 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);
1987 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);
1989 // Apply both effects
1990 scrollView.ApplyEffect(effect);
1991 scrollView.ApplyEffect(newEffect);
1993 DALI_TEST_CHECK( true );
1998 int UtcDaliToolkitScrollViewApplyEffectN(void)
2000 ToolkitTestApplication application;
2001 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectN");
2003 // Create a ScrollView
2004 ScrollView scrollView = ScrollView::New();
2006 // Create two scroll view effects
2007 Dali::Path path = Dali::Path::New();
2008 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);
2009 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);
2011 // Apply both effects
2012 scrollView.ApplyEffect(effect);
2013 scrollView.ApplyEffect(newEffect);
2015 // Attempt to apply the same effect again
2018 scrollView.ApplyEffect(newEffect);
2019 tet_result( TET_FAIL );
2021 catch ( DaliException& e )
2023 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
2029 int UtcDaliToolkitScrollViewRemoveEffectP(void)
2031 ToolkitTestApplication application;
2032 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectP");
2034 // Create a ScrollView
2035 ScrollView scrollView = ScrollView::New();
2037 // Create two scroll view effects
2038 Dali::Path path = Dali::Path::New();
2039 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);
2040 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);
2042 // Apply both effects
2043 scrollView.ApplyEffect(effect);
2044 scrollView.ApplyEffect(newEffect);
2046 // Remove both effects
2047 scrollView.RemoveEffect(effect);
2048 scrollView.RemoveEffect(newEffect);
2050 DALI_TEST_CHECK( true );
2055 int UtcDaliToolkitScrollViewRemoveEffectN(void)
2057 ToolkitTestApplication application;
2058 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectN");
2060 // Create a ScrollView
2061 ScrollView scrollView = ScrollView::New();
2063 // Create two scroll view effects
2064 Dali::Path path = Dali::Path::New();
2065 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);
2066 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);
2068 // Apply the first effect
2069 scrollView.ApplyEffect(effect);
2071 // Attempt to remove the second effect which has not been applied to scroll view
2074 scrollView.RemoveEffect(newEffect);
2075 tet_result( TET_FAIL );
2077 catch ( DaliException& e )
2079 DALI_TEST_ASSERT( e, "effectExistedInScrollView", TEST_LOCATION );
2085 int UtcDaliToolkitScrollViewRemoveAllEffectsP(void)
2087 ToolkitTestApplication application;
2088 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsP");
2090 // Create a ScrollView
2091 ScrollView scrollView = ScrollView::New();
2093 // Create two scroll view effects
2094 Dali::Path path = Dali::Path::New();
2095 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);
2096 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);
2098 // Apply both effects
2099 scrollView.ApplyEffect(effect);
2100 scrollView.ApplyEffect(newEffect);
2102 // Attempt to apply the same first effect again
2105 scrollView.ApplyEffect(effect);
2106 tet_result( TET_FAIL );
2108 catch ( DaliException& e )
2110 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
2113 // Remove both effects
2114 scrollView.RemoveAllEffects();
2116 // Apply both effects again
2117 scrollView.ApplyEffect(effect);
2118 scrollView.ApplyEffect(newEffect);
2120 DALI_TEST_CHECK( true );
2125 int UtcDaliToolkitScrollViewRemoveAllEffectsN(void)
2127 ToolkitTestApplication application;
2128 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsN");
2130 // Create a ScrollView
2131 ScrollView scrollView = ScrollView::New();
2133 // Remove effects when there is no effect applied previously
2134 scrollView.RemoveAllEffects();
2136 DALI_TEST_CHECK( true );
2141 int UtcDaliToolkitScrollViewSetOvershootEnabledP(void)
2143 ToolkitTestApplication application;
2144 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEnabledP");
2146 ScrollView scrollView = ScrollView::New();
2148 scrollView.SetOvershootEnabled(true);
2149 DALI_TEST_CHECK(scrollView.IsOvershootEnabled());
2151 scrollView.SetOvershootEnabled(false);
2152 DALI_TEST_CHECK(!scrollView.IsOvershootEnabled());
2157 int UtcDaliToolkitScrollViewSetOvershootEffectColorP(void)
2159 ToolkitTestApplication application;
2160 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEffectColorP");
2162 ScrollView scrollView = ScrollView::New();
2164 scrollView.SetOvershootEffectColor(Dali::Color::RED);
2165 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::RED, TEST_LOCATION);
2167 scrollView.SetOvershootEffectColor(Dali::Color::YELLOW);
2168 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::YELLOW, TEST_LOCATION);
2173 int UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP(void)
2175 ToolkitTestApplication application;
2176 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP");
2178 ScrollView scrollView = ScrollView::New();
2180 scrollView.SetOvershootAnimationSpeed(55.0f);
2181 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 55.0f, TEST_LOCATION);
2183 scrollView.SetOvershootAnimationSpeed(120.0f);
2184 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 120.0f, TEST_LOCATION);
2189 int UtcDaliToolkitScrollViewGetSet(void)
2191 ToolkitTestApplication application;
2192 tet_infoline(" UtcDaliToolkitScrollViewGetSet");
2193 ScrollView scrollView = ScrollView::New();
2194 scrollView.SetMaxFlickSpeed(0.5f);
2195 DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2196 scrollView.SetFrictionCoefficient(0.6f);
2197 DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2198 scrollView.SetFlickSpeedCoefficient(0.7f);
2199 DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2203 int UtcDaliToolkitScrollViewRulerDomainConstructorP(void)
2205 ToolkitTestApplication application;
2207 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2208 DALI_TEST_EQUALS( domainX.min, 0.0f, TEST_LOCATION);
2209 DALI_TEST_EQUALS( domainX.max, 200.0f, TEST_LOCATION);
2210 DALI_TEST_EQUALS( domainX.enabled, true, TEST_LOCATION);
2212 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2213 DALI_TEST_EQUALS( domainY.min, 100.0f, TEST_LOCATION);
2214 DALI_TEST_EQUALS( domainY.max, 500.0f, TEST_LOCATION);
2215 DALI_TEST_EQUALS( domainY.enabled, false, TEST_LOCATION);
2220 int UtcDaliToolkitScrollViewRulerDomainGetSizeP(void)
2222 ToolkitTestApplication application;
2224 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2225 DALI_TEST_EQUALS( domainX.GetSize(), 200.0f, TEST_LOCATION);
2227 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2228 DALI_TEST_EQUALS( domainY.GetSize(), 400.0f, TEST_LOCATION);
2233 int UtcDaliToolkitScrollViewRulerDomainClampP(void)
2235 ToolkitTestApplication application;
2237 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2239 float value = domainX.Clamp(50.0f, 100.0f, 1.0f);
2240 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2242 value = domainX.Clamp(300.0f, 20.0f, 1.0f);
2243 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2245 value = domainX.Clamp(300.0f, 20.0f, 0.5f);
2246 DALI_TEST_EQUALS( value, 80.0f, TEST_LOCATION);
2248 value = domainX.Clamp(250.0f, 200.0f, 2.0f);
2249 DALI_TEST_EQUALS( value, 200.0f, TEST_LOCATION);
2254 int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void)
2256 ToolkitTestApplication application;
2258 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2261 float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped);
2262 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2263 DALI_TEST_EQUALS( clamped, Dali::Toolkit::NotClamped, TEST_LOCATION);
2265 value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped);
2266 DALI_TEST_EQUALS( value, 0.0f, TEST_LOCATION);
2267 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMin, TEST_LOCATION);
2269 value = domainX.Clamp(300.0f, 20.0f, 1.0f, clamped);
2270 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2271 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMax, TEST_LOCATION);
2276 int UtcDaliToolkitScrollViewDefaultRulerConstructorP(void)
2278 ToolkitTestApplication application;
2279 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerConstructorP");
2281 RulerPtr defaultRuler = new DefaultRuler();
2282 DALI_TEST_CHECK( defaultRuler );
2287 int UtcDaliToolkitScrollViewDefaultRulerDestructorP(void)
2289 ToolkitTestApplication application;
2290 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerDestructorP");
2292 RulerPtr defaultRuler = new DefaultRuler();
2294 DALI_TEST_CHECK( true );
2298 int UtcDaliToolkitScrollViewFixedRulerConstructorP(void)
2300 ToolkitTestApplication application;
2301 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerConstructorP");
2303 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2304 DALI_TEST_CHECK( fixedRuler );
2306 fixedRuler = new FixedRuler( 0.0f );
2307 DALI_TEST_CHECK( fixedRuler );
2312 int UtcDaliToolkitScrollViewFixedRulerDestructorP(void)
2314 ToolkitTestApplication application;
2315 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerDestructorP");
2317 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2319 DALI_TEST_CHECK( true );
2323 int UtcDaliToolkitScrollViewRulerGetTypeP(void)
2325 ToolkitTestApplication application;
2326 tet_infoline(" UtcDaliToolkitScrollViewRulerGetTypeP");
2328 RulerPtr defaultRuler = new DefaultRuler();
2329 DALI_TEST_CHECK( defaultRuler );
2330 DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::Free, TEST_LOCATION);
2332 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2333 DALI_TEST_CHECK( fixedRuler );
2334 DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::Fixed, TEST_LOCATION);
2339 int UtcDaliToolkitScrollViewRulerGetExtensionP(void)
2341 ToolkitTestApplication application;
2342 tet_infoline(" UtcDaliToolkitScrollViewRulerGetExtensionP");
2344 RulerPtr defaultRuler = new DefaultRuler();
2345 DALI_TEST_CHECK( defaultRuler );
2346 DALI_TEST_CHECK( !defaultRuler->GetExtension() );
2348 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2349 DALI_TEST_CHECK( fixedRuler );
2350 DALI_TEST_CHECK( !fixedRuler->GetExtension() );
2355 int UtcDaliToolkitScrollViewRulerEnableDisable(void)
2357 ToolkitTestApplication application;
2358 tet_infoline(" UtcDaliToolkitScrollViewRulerEnableDisable");
2360 RulerPtr ruler = new DefaultRuler();
2362 DALI_TEST_CHECK( ruler->IsEnabled() );
2364 DALI_TEST_CHECK( !ruler->IsEnabled() );
2366 DALI_TEST_CHECK( ruler->IsEnabled() );
2370 int UtcDaliToolkitScrollViewRulerDomainEnableDisable(void)
2372 ToolkitTestApplication application;
2373 tet_infoline(" UtcDaliToolkitScrollViewRulerDomainEnableDisable");
2375 RulerPtr ruler = new DefaultRuler();
2376 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2378 ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) );
2379 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION );
2380 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION );
2381 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION );
2383 ruler->DisableDomain();
2384 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2385 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION );
2386 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION );
2390 int UtcDaliToolkitScrollViewRulerSnapAndClamp(void)
2392 ToolkitTestApplication application;
2393 tet_infoline(" UtcDaliToolkitScrollViewRulerSnapAndClamp");
2395 RulerPtr ruler = new FixedRuler( 50.0f );
2396 ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2398 // default testing. (snap and clamp)
2399 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION);
2400 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION);
2401 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION);
2402 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION);
2403 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION);
2404 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION);
2407 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2408 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick
2409 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2411 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2412 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick
2413 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2416 DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary)
2417 DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary)
2418 DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary)
2419 DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary)
2420 DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary)
2423 DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION);
2424 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION);
2425 DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION);
2426 DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION);
2428 // clamp state testing.
2430 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2431 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2432 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2433 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2434 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2435 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2436 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2437 DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION );
2438 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2439 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2440 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2441 DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION );
2445 int UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP(void)
2447 ToolkitTestApplication application;
2448 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP");
2450 RulerPtr rulerNormal = new FixedRuler( 25.0f );
2451 rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) );
2453 unsigned int volume;
2456 position = rulerNormal->GetPositionFromPage(1, volume, true);
2457 DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION );
2458 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2460 position = rulerNormal->GetPositionFromPage(2, volume, true);
2461 DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION );
2462 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2464 // Disable the ruler
2465 rulerNormal->Disable();
2467 position = rulerNormal->GetPositionFromPage(1, volume, true);
2468 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2469 DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION );
2471 position = rulerNormal->GetPositionFromPage(2, volume, true);
2472 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2473 DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION );
2478 int UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP(void)
2480 ToolkitTestApplication application;
2481 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP");
2483 RulerPtr defaultRuler = new DefaultRuler();
2484 DALI_TEST_CHECK( defaultRuler );
2485 DALI_TEST_EQUALS( defaultRuler->GetTotalPages(), 1u, TEST_LOCATION);
2490 int UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP(void)
2492 ToolkitTestApplication application;
2493 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP");
2495 RulerPtr defaultRuler = new DefaultRuler();
2496 DALI_TEST_CHECK( defaultRuler );
2497 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(100.0f, true), 0u, TEST_LOCATION);
2498 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(-300.0f, false), 0u, TEST_LOCATION);
2503 int UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP(void)
2505 ToolkitTestApplication application;
2506 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP");
2508 RulerPtr defaultRuler = new DefaultRuler();
2509 DALI_TEST_CHECK( defaultRuler );
2511 unsigned int volume;
2512 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(0, volume, true), 0.0f, TEST_LOCATION);
2513 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2515 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(3, volume, false), 0.0f, TEST_LOCATION);
2516 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2521 int UtcDaliToolkitScrollViewDefaultRulerSnapP(void)
2523 ToolkitTestApplication application;
2524 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerSnapP");
2526 RulerPtr defaultRuler = new DefaultRuler();
2527 DALI_TEST_CHECK( defaultRuler );
2529 DALI_TEST_EQUALS( defaultRuler->Snap(50.0f, 0.5f), 50.0f, TEST_LOCATION);
2530 DALI_TEST_EQUALS( defaultRuler->Snap(-120.0f, 1.0f), -120.0f, TEST_LOCATION);
2535 int UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP(void)
2537 ToolkitTestApplication application;
2538 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP");
2540 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2541 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2543 fixedRuler->Enable();
2544 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 4u, TEST_LOCATION);
2546 fixedRuler->Disable();
2547 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 1u, TEST_LOCATION);
2552 int UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP(void)
2554 ToolkitTestApplication application;
2555 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP");
2557 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2558 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2560 fixedRuler->Enable();
2561 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 3u, TEST_LOCATION);
2562 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2563 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 1u, TEST_LOCATION);
2564 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2566 fixedRuler->Disable();
2567 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2568 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2569 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2570 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2572 // Set domain size to be smaller than the ruler space
2573 fixedRuler->SetDomain( RulerDomain(0.0f, 50.0f, true) );
2575 fixedRuler->Enable();
2576 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2577 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2578 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2579 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2581 fixedRuler->Disable();
2582 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2583 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2584 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2585 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2590 int UtcDaliToolkitScrollViewFixedRulerSnapP(void)
2592 ToolkitTestApplication application;
2593 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerSnapP");
2595 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2596 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2598 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.0f), -100.0f, TEST_LOCATION);
2599 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.0f), -100.0f, TEST_LOCATION);
2600 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.0f), -200.0f, TEST_LOCATION);
2601 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.0f), -500.0f, TEST_LOCATION);
2602 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.0f), 0.0f, TEST_LOCATION);
2603 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.0f), 0.0f, TEST_LOCATION);
2604 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.0f), 0.0f, TEST_LOCATION);
2605 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.0f), 100.0f, TEST_LOCATION);
2606 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.0f), 100.0f, TEST_LOCATION);
2607 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.0f), 200.0f, TEST_LOCATION);
2608 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.0f), 600.0f, TEST_LOCATION);
2610 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.5f), 0.0f, TEST_LOCATION);
2611 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.5f), -100.0f, TEST_LOCATION);
2612 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.5f), -100.0f, TEST_LOCATION);
2613 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.5f), -500.0f, TEST_LOCATION);
2614 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.5f), 0.0f, TEST_LOCATION);
2615 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.5f), 100.0f, TEST_LOCATION);
2616 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.5f), 100.0f, TEST_LOCATION);
2617 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.5f), 100.0f, TEST_LOCATION);
2618 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.5f), 100.0f, TEST_LOCATION);
2619 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.5f), 300.0f, TEST_LOCATION);
2620 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.5f), 600.0f, TEST_LOCATION);
2622 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 1.0f), 0.0f, TEST_LOCATION);
2623 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 1.0f), 0.0f, TEST_LOCATION);
2624 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 1.0f), -100.0f, TEST_LOCATION);
2625 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 1.0f), -400.0f, TEST_LOCATION);
2626 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 1.0f), 100.0f, TEST_LOCATION);
2627 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 1.0f), 100.0f, TEST_LOCATION);
2628 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 1.0f), 100.0f, TEST_LOCATION);
2629 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 1.0f), 200.0f, TEST_LOCATION);
2630 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 1.0f), 200.0f, TEST_LOCATION);
2631 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 1.0f), 300.0f, TEST_LOCATION);
2632 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 1.0f), 700.0f, TEST_LOCATION);
2637 int UtcDaliToolkitScrollViewConstraintsMove(void)
2639 ToolkitTestApplication application;
2640 tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove");
2642 // Set up a scrollView...
2643 ScrollView scrollView = ScrollView::New();
2644 application.GetScene().Add( scrollView );
2645 Vector2 stageSize = application.GetScene().GetSize();
2646 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
2647 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
2648 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2651 RulerPtr rulerX = new DefaultRuler();
2652 RulerPtr rulerY = new DefaultRuler();
2653 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2654 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2655 scrollView.SetRulerX(rulerX);
2656 scrollView.SetRulerY(rulerY);
2658 // Add an Actor to ScrollView,
2659 Actor a = Actor::New();
2661 a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION);
2664 const Vector2 target = Vector2(100.0f, 100.0f);
2665 const Vector2 target2 = Vector2(200.0f, 200.0f);
2667 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, MoveActorConstraint );
2668 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
2669 constraint.SetRemoveAction(Constraint::Discard);
2670 scrollView.ApplyConstraintToChildren(constraint);
2672 scrollView.ScrollTo( target, 0.0f );
2674 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2675 scrollView.ScrollTo( target2 );
2676 Wait(application, RENDER_DELAY_SCROLL);
2677 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2682 int UtcDaliToolkitScrollViewConstraintsWrap(void)
2684 ToolkitTestApplication application;
2685 tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap");
2687 // Set up a scrollView...
2688 ScrollView scrollView = ScrollView::New();
2689 application.GetScene().Add( scrollView );
2690 Vector2 stageSize = application.GetScene().GetSize();
2691 scrollView.SetProperty( Actor::Property::SIZE, stageSize);
2692 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
2693 scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2696 RulerPtr rulerX = new DefaultRuler();
2697 RulerPtr rulerY = new DefaultRuler();
2698 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2699 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2700 scrollView.SetRulerX(rulerX);
2701 scrollView.SetRulerY(rulerY);
2703 // Add an Actor to ScrollView,
2704 Actor a = Actor::New();
2706 a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION);
2709 const Vector2 target = Vector2(100.0f, 100.0f);
2710 const Vector2 target2 = Vector2(200.0f, 200.0f);
2712 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, WrapActorConstraint );
2713 constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
2714 constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
2715 constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
2716 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
2717 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
2718 constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) );
2719 constraint.SetRemoveAction(Constraint::Discard);
2720 scrollView.ApplyConstraintToChildren(constraint);
2722 scrollView.ScrollTo( target, 0.0f );
2724 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2725 scrollView.ScrollTo( target2 );
2726 Wait(application, RENDER_DELAY_SCROLL);
2727 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2729 scrollView.Remove(a);
2735 // Non-API test (so no P or N variant).
2736 int UtcDaliToolkitScrollViewGesturePageLimit(void)
2738 ToolkitTestApplication application;
2739 tet_infoline( " UtcDaliToolkitScrollViewGesturePageLimit" );
2741 // Set up a scrollView.
2742 ScrollView scrollView = ScrollView::New();
2744 // Do not rely on stage size for UTC tests.
2745 Vector2 viewPageSize( 720.0f, 1280.0f );
2746 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
2747 scrollView.SetProperty( Actor::Property::SIZE, viewPageSize );
2748 scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
2749 scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
2750 scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
2753 // We set the X ruler to fixed to give us pages to snap to.
2754 Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( viewPageSize.width );
2755 // Note: The 3x page width is arbitary, but we need enough to show that we are
2756 // capping page movement by the page limiter, and not the domain.
2757 rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, viewPageSize.width * 3.0f, false ) );
2758 Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler();
2760 scrollView.SetRulerX( rulerX );
2761 scrollView.SetRulerY( rulerY );
2763 scrollView.SetWrapMode( false );
2764 scrollView.SetScrollSensitive( true );
2766 application.GetScene().Add( scrollView );
2768 // Set up a gesture to perform.
2769 Vector2 startPos( 50.0f, 0.0f );
2770 Vector2 direction( -5.0f, 0.0f );
2773 // Force starting position.
2774 scrollView.ScrollTo( startPos, 0.0f );
2776 time += Wait( application );
2778 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
2779 Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
2781 // Confirm the final X coord has not moved more than one page from the start X position.
2782 DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
2784 // Finish the gesture and wait for the snap.
2785 currentPos += direction;
2786 TestEndPan(application, currentPos, time);
2787 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
2788 time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
2790 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
2791 DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2796 int UtcDaliScrollViewSetGetProperty(void)
2798 ToolkitTestApplication application;
2800 // Create the ScrollView actor
2801 ScrollView scrollView = ScrollView::New();
2802 DALI_TEST_CHECK(scrollView);
2804 // Event side properties
2806 // Test "wrapEnabled" property
2807 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED );
2808 scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true );
2809 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get<bool>(), true, TEST_LOCATION );
2811 // Test "panningEnabled" property
2812 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED );
2813 scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false );
2814 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get<bool>(), false, TEST_LOCATION );
2816 // Test "axisAutoLockEnabled" property
2817 DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED );
2818 scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false );
2819 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get<bool>(), false, TEST_LOCATION );
2821 // Test "wheelScrollDistanceStep" property
2822 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP );
2823 scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) );
2824 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<Vector2>(), Vector2(100.0f, 50.0f), TEST_LOCATION );
2826 // Test "overshootEnabled" property
2827 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
2828 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), scrollView.IsOvershootEnabled(), TEST_LOCATION );
2829 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
2830 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
2832 // Animatable properties
2834 // Test "scrollPosition" property
2835 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION );
2836 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) );
2838 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get<Vector2>(), Vector2(320.0f, 550.0f), TEST_LOCATION );
2840 // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties
2841 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION );
2842 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) );
2844 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(300.0f, 500.0f), TEST_LOCATION );
2846 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X );
2847 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y );
2848 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 300.0f, TEST_LOCATION );
2849 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 500.0f, TEST_LOCATION );
2850 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f );
2851 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f );
2853 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 400.0f, TEST_LOCATION );
2854 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 600.0f, TEST_LOCATION );
2855 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(400.0f, 600.0f), TEST_LOCATION );
2857 // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties
2858 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX );
2859 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) );
2861 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(100.0f, 200.0f), TEST_LOCATION );
2863 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X );
2864 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y );
2865 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 100.0f, TEST_LOCATION );
2866 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 200.0f, TEST_LOCATION );
2867 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f );
2868 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f );
2870 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 300.0f, TEST_LOCATION );
2871 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 400.0f, TEST_LOCATION );
2872 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(300.0f, 400.0f), TEST_LOCATION );
2874 // Test "overshootX" property
2875 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X );
2876 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f );
2878 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get<float>(), 0.8f, TEST_LOCATION );
2880 // Test "overshootY" property
2881 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y );
2882 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f );
2884 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get<float>(), 0.8f, TEST_LOCATION );
2886 // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties
2887 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL );
2888 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) );
2890 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(200.0f, 300.0f), TEST_LOCATION );
2892 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X );
2893 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y );
2894 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 200.0f, TEST_LOCATION );
2895 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 300.0f, TEST_LOCATION );
2896 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f );
2897 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f );
2899 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 500.0f, TEST_LOCATION );
2900 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 600.0f, TEST_LOCATION );
2901 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(500.0f, 600.0f), TEST_LOCATION );
2903 // Test "wrap" property
2904 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP );
2905 scrollView.SetProperty( ScrollView::Property::WRAP, false );
2907 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get<bool>(), false, TEST_LOCATION );
2909 // Test "panning" property
2910 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING );
2911 scrollView.SetProperty( ScrollView::Property::PANNING, true );
2913 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get<bool>(), true, TEST_LOCATION );
2915 // Test "scrolling" property
2916 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING );
2917 scrollView.SetProperty( ScrollView::Property::SCROLLING, false );
2919 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get<bool>(), false, TEST_LOCATION );
2921 // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties
2922 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE );
2923 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) );
2925 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1200.0f, 1300.0f), TEST_LOCATION );
2927 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
2928 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
2929 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1200.0f, TEST_LOCATION );
2930 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1300.0f, TEST_LOCATION );
2931 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f );
2932 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f );
2934 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1500.0f, TEST_LOCATION );
2935 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1600.0f, TEST_LOCATION );
2936 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1500.0f, 1600.0f), TEST_LOCATION );
2938 // Test "scrollDomainOffset" property
2939 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET );
2940 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) );
2942 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get<Vector2>(), Vector2(500.0f, 200.0f), TEST_LOCATION );
2944 // Test "scrollPositionDelta" property
2945 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA );
2946 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) );
2948 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get<Vector2>(), Vector2(10.0f, 30.0f), TEST_LOCATION );
2950 // Test "startPagePosition" property
2951 DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION );
2952 scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) );
2954 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get<Vector3>(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION );