2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali/integration-api/events/pan-gesture-event.h>
24 #include <dali-toolkit/devel-api/controls/scrollable/scroll-view/scroll-view-devel.h>
25 #include <dali-toolkit/devel-api/controls/scrollable/scroll-view/scroll-mode.h>
28 using namespace Toolkit;
30 void scroll_view_startup(void)
32 test_return_value = TET_UNDEF;
35 void scroll_view_cleanup(void)
37 test_return_value = TET_PASS;
42 static bool gObjectCreatedCallBackCalled;
44 static void TestCallback(BaseHandle handle)
46 gObjectCreatedCallBackCalled = true;
49 struct CallbackFunctor
51 CallbackFunctor(bool* callbackFlag)
52 : mCallbackFlag( callbackFlag )
58 *mCallbackFlag = true;
63 const int MILLISECONDS_PER_SECOND = 1000;
64 const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
65 const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
67 const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
69 // For Clamp Signal testing...
70 const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview
71 const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview
72 const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0; ///< FSM: "First check that scrollview isn't clamped"
73 const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side"
74 const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side"
75 const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)"
76 const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f); ///< Scroll start position for the Clamping tests.
77 const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
78 const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
79 const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
80 const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value)
81 const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
82 const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons.
84 const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); ///< Default overshoot snapping animation time.
85 const float DEFAULT_MAX_OVERSHOOT(100.0f); ///< Default maximum allowed overshoot in pixels
87 const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
88 const Vector2 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f); ///< Scroll start position for the Overshoot tests.
89 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)
90 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).
91 const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
92 const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
93 const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
94 const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
97 // Generate a PanGestureEvent to send to Core
98 Integration::PanGestureEvent GeneratePan(
100 const Vector2& previousPosition,
101 const Vector2& currentPosition,
102 unsigned long timeDelta,
103 unsigned int numberOfTouches = 1)
105 Integration::PanGestureEvent pan(state);
107 pan.previousPosition = previousPosition;
108 pan.currentPosition = currentPosition;
109 pan.timeDelta = timeDelta;
110 pan.numberOfTouches = numberOfTouches;
116 * Helper to generate PanGestureEvent
118 * @param[in] application Application instance
119 * @param[in] state The Gesture State
120 * @param[in] pos The current position of touch.
122 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
126 if( (state == Gesture::Started) ||
127 (state == Gesture::Possible) )
133 application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
140 * Simulate time passed by.
142 * @note this will always process at least 1 frame (1/60 sec)
144 * @param application Test application instance
145 * @param duration Time to pass in milliseconds.
146 * @return The actual time passed in milliseconds
148 int Wait(ToolkitTestApplication& application, int duration = 0)
152 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
154 application.SendNotification();
155 application.Render(RENDER_FRAME_INTERVAL);
156 time += RENDER_FRAME_INTERVAL;
164 static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
165 static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
166 static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
167 static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
168 static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
169 static Vector3 gConstraintResult; ///< Result from constraint.
172 * Invoked when scrolling starts.
174 * @param[in] position The current scroll position.
176 static void OnScrollStart( const Vector2& position )
178 gOnScrollStartCalled = true;
182 * Invoked when scrolling updates (via dragging)
184 * @param[in] position The current scroll position.
186 static void OnScrollUpdate( const Vector2& position )
188 gOnScrollUpdateCalled = true;
192 * Invoked when scrolling finishes
194 * @param[in] position The current scroll position.
196 static void OnScrollComplete( const Vector2& position )
198 gOnScrollCompleteCalled = true;
202 * Invoked when a snap or flick started.
204 * @param[in] event The type of snap and the target position/scale/rotation.
206 static void OnSnapStart( const ScrollView::SnapEvent& event )
208 gOnSnapStartCalled = true;
209 gLastSnapType = event.type;
215 * Summation of current value, property, and offset.
217 * current' = current + mOffset + property;
219 struct TestSumConstraint
222 * @param[in] offset The offset to be added to current.
224 TestSumConstraint(const Vector3& offset)
230 * @param[in] current The current base value
231 * @param[in] inputs Contains the property to be added to current.
232 * @return The new current Vector.
234 void operator()( Vector3& current, const PropertyInputContainer& inputs )
236 gConstraintResult = current + Vector3(inputs[0]->GetVector2()) + mOffset;
237 current = gConstraintResult;
245 * @param[in] application The application instance
246 * @param[in] scrollView The scrollView instance
247 * @return The time taken for the overshoot to reach origin (zero)
249 static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
251 int timeToReachOrigin = -1;
252 for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
254 float overshootXValue = scrollView.GetCurrentProperty<float>( ScrollView::Property::OVERSHOOT_X );
255 float overshootYValue = scrollView.GetCurrentProperty<float>( ScrollView::Property::OVERSHOOT_Y );
256 if(overshootXValue == 0.0f && overshootYValue == 0.0f)
261 timeToReachOrigin += Wait(application);
264 return static_cast<float>(timeToReachOrigin) * 0.001f; // return in seconds not ms.
268 * y = 2x alpha function, which is clamped between 0.0f - 1.0f
270 * Animations should appear to finish (reach 100% point)
271 * at just half the time of a regular Linear AlphaFunction.
273 * @param[in] progress value (ranges from 0.0f - 1.0f)
274 * @return interpolation value (ranges from 0.0f - 1.0f)
276 float TestAlphaFunction(float progress)
278 return std::min( progress * 2.0f, 1.0f );
281 static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
283 gOnScrollStartCalled = false;
284 gOnScrollUpdateCalled = false;
285 gOnScrollCompleteCalled = false;
286 gOnSnapStartCalled = false;
288 // Now do a pan starting from (start) and heading (direction)
290 SendPan(application, Gesture::Possible, pos);
291 SendPan(application, Gesture::Started, pos);
294 for(int i = 0;i<frames;i++)
296 pos += direction; // Move in this direction
297 SendPan(application, Gesture::Continuing, pos);
303 pos += direction; // Move in this direction.
304 SendPan(application, Gesture::Finished, pos);
305 Wait(application, RENDER_DELAY_SCROLL);
312 } // unnamed namespace
315 int UtcDaliToolkitScrollViewConstructorP(void)
317 ToolkitTestApplication application;
319 ScrollView scrollView;
320 DALI_TEST_CHECK( !scrollView );
324 int UtcDaliToolkitScrollViewCopyConstructorP(void)
326 ToolkitTestApplication application;
328 ScrollView scrollView = ScrollView::New();
329 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
331 ScrollView copy( scrollView );
332 DALI_TEST_CHECK( copy );
333 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
337 int UtcDaliToolkitScrollViewAssignmentOperatorP(void)
339 ToolkitTestApplication application;
341 ScrollView scrollView = ScrollView::New();
342 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
344 ScrollView copy = scrollView;
345 DALI_TEST_CHECK( copy );
346 DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
350 int UtcDaliScrollViewDestructorP(void)
352 ToolkitTestApplication application;
354 ScrollView* scrollView = new ScrollView();
357 DALI_TEST_CHECK( true );
361 int UtcDaliToolkitScrollViewNewP1(void)
363 ToolkitTestApplication application;
364 tet_infoline(" UtcDaliToolkitScrollViewNewP1");
366 ScrollView scrollView;
368 DALI_TEST_CHECK( !scrollView );
370 scrollView = ScrollView::New();
372 DALI_TEST_CHECK( scrollView );
374 ScrollView scrollView2(scrollView);
376 DALI_TEST_CHECK( scrollView2 == scrollView );
378 //Additional check to ensure object is created by checking if it's registered
379 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
380 DALI_TEST_CHECK( registry );
382 gObjectCreatedCallBackCalled = false;
383 registry.ObjectCreatedSignal().Connect( &TestCallback );
385 ScrollView scrollView = ScrollView::New();
387 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
391 int UtcDaliToolkitScrollViewNewP2(void)
393 ToolkitTestApplication application;
394 tet_infoline(" UtcDaliToolkitScrollViewNewP2 - create thru type registry");
396 ScrollView scrollView;
397 DALI_TEST_CHECK( !scrollView );
399 TypeRegistry typeRegistry = TypeRegistry::Get();
400 TypeInfo scrollViewType = typeRegistry.GetTypeInfo("ScrollView");
401 BaseHandle handle = scrollViewType.CreateInstance();
402 DALI_TEST_CHECK( handle );
404 scrollView = ScrollView::DownCast(handle);
405 DALI_TEST_CHECK( scrollView );
410 int UtcDaliToolkitScrollViewDownCastP(void)
412 ToolkitTestApplication application;
413 tet_infoline(" UtcDaliToolkitScrollViewDownCastP");
415 ScrollView scrollView = ScrollView::New();
416 BaseHandle handle(scrollView);
418 ScrollView newScrollView = ScrollView::DownCast( handle );
419 DALI_TEST_CHECK( scrollView );
420 DALI_TEST_CHECK( newScrollView == scrollView );
424 int UtcDaliToolkitScrollViewScrollToPositionP(void)
426 ToolkitTestApplication application;
427 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionP");
429 // Create the ScrollView actor
430 ScrollView scrollView = ScrollView::New();
431 Stage::GetCurrent().Add( scrollView );
433 const Vector2 target = Vector2(100.0f, 200.0f);
434 const Vector2 target2 = Vector2(300.0f, 100.0f);
436 scrollView.ScrollTo( target, 0.0f );
438 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
439 scrollView.ScrollTo( target2 );
440 Wait(application, RENDER_DELAY_SCROLL);
441 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
446 int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void)
448 ToolkitTestApplication application;
449 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP");
451 ScrollView scrollView = ScrollView::New();
452 Stage::GetCurrent().Add( scrollView );
453 RulerPtr rulerX = new FixedRuler( 100.0f );
454 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
455 RulerPtr rulerY = new FixedRuler( 100.0f );
456 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
458 scrollView.SetRulerX( rulerX );
459 scrollView.SetRulerY( rulerY );
461 scrollView.SetWrapMode(true);
463 Property::Value wrapMode = scrollView.GetProperty( Toolkit::ScrollView::Property::WRAP_ENABLED );
464 DALI_TEST_EQUALS( wrapMode.Get<bool>(), true, TEST_LOCATION );
466 const Vector2 target = Vector2(50.0f, 50.0f);
467 const Vector2 target2 = Vector2(150.0f, 150.0f);
469 scrollView.ScrollTo( target, 0.0f );
470 Wait(application, RENDER_DELAY_SCROLL);
471 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
473 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
474 Wait(application, RENDER_DELAY_SCROLL);
475 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
477 scrollView.ScrollTo( target, 0.0f );
478 Wait(application, RENDER_DELAY_SCROLL);
479 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
481 scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
482 Wait(application, RENDER_DELAY_SCROLL);
483 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
488 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP(void)
490 ToolkitTestApplication application;
491 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP");
493 // Create the ScrollView actor
494 ScrollView scrollView = ScrollView::New();
495 Stage::GetCurrent().Add( scrollView );
497 const Vector2 target = Vector2(100.0f, 200.0f);
498 const Vector2 target2 = Vector2(300.0f, 100.0f);
500 scrollView.ScrollTo( target, 0.5f, TestAlphaFunction );
501 Wait(application, 250);
502 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
503 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
505 scrollView.ScrollTo( target2, 0.5f, AlphaFunction::LINEAR );
506 Wait(application, 250);
507 // Check that the scroll animation has not finished within half of the specified duration with the linear alpha function
508 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition() != target2 );
510 // Wait till the end of the specified duration
511 Wait(application, 250);
512 // Check that the scroll animation has finished
513 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
518 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(void)
520 ToolkitTestApplication application;
521 tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP");
523 ScrollView scrollView = ScrollView::New();
524 Stage::GetCurrent().Add( scrollView );
525 RulerPtr rulerX = new FixedRuler( 100.0f );
526 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
527 RulerPtr rulerY = new FixedRuler( 100.0f );
528 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
530 scrollView.SetRulerX( rulerX );
531 scrollView.SetRulerY( rulerY );
533 scrollView.SetWrapMode(true);
535 const Vector2 target = Vector2(50.0f, 50.0f);
536 const Vector2 target2 = Vector2(150.0f, 150.0f);
538 scrollView.ScrollTo( target, 0.0f );
539 Wait(application, RENDER_DELAY_SCROLL);
540 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
542 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
543 Wait(application, RENDER_DELAY_SCROLL);
544 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
546 scrollView.ScrollTo( target, 0.0f );
547 Wait(application, RENDER_DELAY_SCROLL);
548 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
550 scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
551 Wait(application, RENDER_DELAY_SCROLL);
552 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
554 scrollView.ScrollTo( target, 0.0f );
555 Wait(application, RENDER_DELAY_SCROLL);
556 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
558 scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
559 Wait(application, 125);
560 // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
561 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
566 int UtcDaliToolkitScrollViewScrollToPageP(void)
568 ToolkitTestApplication application;
569 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageP");
571 ScrollView scrollView = ScrollView::New();
572 Stage::GetCurrent().Add( scrollView );
573 RulerPtr rulerX = new FixedRuler( 100.0f );
574 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
575 RulerPtr rulerY = new FixedRuler( 100.0f );
576 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
578 scrollView.SetRulerX( rulerX );
579 scrollView.SetRulerY( rulerY );
581 scrollView.ScrollTo( 1, 0.0f );
583 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
585 scrollView.ScrollTo( 5, 0.0f );
587 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(500.0f, 0.0f), TEST_LOCATION );
589 scrollView.ScrollTo( 10, 0.0f );
591 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 100.0f), TEST_LOCATION );
593 scrollView.ScrollTo( 15, 0.0f );
595 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(700.0f, 100.0f), TEST_LOCATION );
596 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
598 scrollView.ScrollTo( 3 );
599 Wait(application, RENDER_DELAY_SCROLL);
600 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(300.0f, 0.0f), TEST_LOCATION );
601 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
603 scrollView.ScrollTo( 9 );
604 Wait(application, RENDER_DELAY_SCROLL);
605 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 100.0f), TEST_LOCATION );
606 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
608 // Apply DefaultRulers instead and see what happens.
609 rulerX = new DefaultRuler();
610 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
611 rulerY = new DefaultRuler();
612 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
614 scrollView.SetRulerX( rulerX );
615 scrollView.SetRulerY( rulerY );
617 // This time should always scroll to origin (0.0f, 0.0f)
618 scrollView.ScrollTo( 1, 0.0f );
620 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
621 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
627 int UtcDaliToolkitScrollModeP1(void)
629 ToolkitTestApplication application;
630 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
632 // Set up a scrollView.
633 ScrollView scrollView = ScrollView::New();
635 // Do not rely on stage size for UTC tests.
636 Vector2 pageSize( 720.0f, 1280.0f );
637 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
638 scrollView.SetSize( pageSize );
639 scrollView.SetParentOrigin( ParentOrigin::CENTER );
640 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
641 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
644 Property::Map rulerMap;
645 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
646 rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, pageSize.width );
647 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, pageSize.width*3 );
648 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, false );
649 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
651 scrollView.SetWrapMode( false );
652 scrollView.SetScrollSensitive( true );
654 Stage::GetCurrent().Add( scrollView );
656 // Set up a gesture to perform.
657 Vector2 startPos( 50.0f, 0.0f );
658 Vector2 direction( -5.0f, 0.0f );
661 // Force starting position.
662 scrollView.ScrollTo( startPos, 0.0f );
665 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
666 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
668 // Confirm the final X coord has not moved more than one page from the start X position.
669 DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
671 // Finish the gesture and wait for the snap.
672 currentPos += direction;
673 SendPan( application, Gesture::Finished, currentPos );
674 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
675 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
677 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
678 DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
683 int UtcDaliToolkitScrollModeP2(void)
685 ToolkitTestApplication application;
686 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
688 // Set up a scrollView.
689 ScrollView scrollView = ScrollView::New();
691 // Do not rely on stage size for UTC tests.
692 Vector2 pageSize( 720.0f, 1280.0f );
693 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
694 scrollView.SetSize( pageSize );
695 scrollView.SetParentOrigin( ParentOrigin::CENTER );
696 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
697 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
700 Property::Map rulerMap;
701 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
702 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
703 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
704 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
705 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
707 scrollView.SetWrapMode( false );
708 scrollView.SetScrollSensitive( true );
710 Stage::GetCurrent().Add( scrollView );
712 // Set up a gesture to perform.
713 Vector2 startPos( 0.0f, 50.0f );
714 Vector2 direction( 0.0f, -6.0f );
717 // Force starting position.
718 scrollView.ScrollTo( startPos, 0.0f );
721 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
722 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
724 // Confirm the final X coord has not moved more than one page from the start X position.
725 DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
727 // Finish the gesture and wait for the snap.
728 currentPos += direction;
729 SendPan( application, Gesture::Finished, currentPos );
730 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
731 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
733 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
734 DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
739 int UtcDaliToolkitScrollModeP3(void)
741 ToolkitTestApplication application;
742 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" );
744 // Set up a scrollView.
745 ScrollView scrollView = ScrollView::New();
747 // Do not rely on stage size for UTC tests.
748 Vector2 pageSize( 720.0f, 1280.0f );
749 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
750 scrollView.SetSize( pageSize );
751 scrollView.SetParentOrigin( ParentOrigin::CENTER );
752 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
753 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
756 Property::Map rulerMap;
757 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
758 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
759 rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
760 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
761 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
763 scrollView.SetWrapMode( false );
764 scrollView.SetScrollSensitive( true );
766 Stage::GetCurrent().Add( scrollView );
768 // Set up a gesture to perform.
769 Vector2 startPos( 0.0f, 50.0f );
770 Vector2 direction( 0.0f, -6.0f );
773 // Force starting position.
774 scrollView.ScrollTo( startPos, 0.0f );
777 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
778 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
780 // Confirm the final X coord has not moved more than one page from the start X position.
781 DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
783 // Finish the gesture and wait for the snap.
784 currentPos += direction;
785 SendPan( application, Gesture::Finished, currentPos );
786 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
787 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
789 // Confirm the final Y coord has snapped to exactly one page ahead of the start page.
790 DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
795 int UtcDaliToolkitScrollModeP4(void)
797 ToolkitTestApplication application;
798 tet_infoline( " UtcDaliToolkitScrollView ScrollMode property, DefaultRulers" );
800 // Set up a scrollView.
801 ScrollView scrollView = ScrollView::New();
803 // Do not rely on stage size for UTC tests.
804 Vector2 pageSize( 720.0f, 1280.0f );
805 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
806 scrollView.SetSize( pageSize );
807 scrollView.SetParentOrigin( ParentOrigin::TOP_LEFT );
808 scrollView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
809 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
811 // Position rulers - expect Default rulers to be used which don't snap
812 Property::Map rulerMap;
813 rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
814 rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
815 scrollView.SetProperty( DevelScrollView::Property::SCROLL_MODE, rulerMap);
817 scrollView.SetWrapMode( false );
818 scrollView.SetScrollSensitive( true );
820 Stage::GetCurrent().Add( scrollView );
822 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
824 scrollView.ScrollTo(START_POSITION, 0.0f);
826 // Try a vertical swipe.
827 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
828 // Take into account resampling done when prediction is off.
829 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
835 int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void)
837 ToolkitTestApplication application;
838 tet_infoline(" UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP");
840 ScrollView scrollView = ScrollView::New();
841 Stage::GetCurrent().Add( scrollView );
842 RulerPtr rulerX = new FixedRuler( 100.0f );
843 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
844 RulerPtr rulerY = new FixedRuler( 100.0f );
845 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
847 scrollView.SetRulerX( rulerX );
848 scrollView.SetRulerY( rulerY );
850 scrollView.SetWrapMode(true);
852 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasLeft );
854 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
855 // Check that the scroll position remains the same
856 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
858 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
859 // Check that it stays at the same page (i.e. the same scroll position)
860 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
861 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
863 scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasRight );
865 Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
866 // Check that it scrolls towards the right
867 DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition().x > 0.0f );
869 Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
870 // Check that it scrolls back to the same page (i.e. the same scroll position)
871 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
872 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
877 int UtcDaliToolkitScrollViewScrollToActorP(void)
879 ToolkitTestApplication application;
880 tet_infoline(" UtcDaliToolkitScrollViewScrollToActorP");
882 ScrollView scrollView = ScrollView::New();
883 Stage::GetCurrent().Add( scrollView );
885 Actor actorA = Actor::New();
886 const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f);
887 actorA.SetPosition(positionA);
888 scrollView.Add(actorA);
890 Actor actorB = Actor::New();
891 const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f);
892 actorB.SetPosition(positionB);
893 scrollView.Add(actorB);
897 scrollView.ScrollTo(actorA, 0.0f);
899 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
902 scrollView.ScrollTo(actorB, 0.0f);
904 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
906 scrollView.ScrollTo(actorA);
907 Wait(application, RENDER_DELAY_SCROLL);
908 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
910 scrollView.ScrollTo(actorB);
911 Wait(application, RENDER_DELAY_SCROLL);
912 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
916 int UtcDaliToolkitScrollViewScrollToSnapPointP(void)
918 ToolkitTestApplication application;
919 tet_infoline(" UtcDaliToolkitScrollViewScrollToSnapPointP");
921 ScrollView scrollView = ScrollView::New();
922 Stage::GetCurrent().Add( scrollView );
923 RulerPtr rulerX = new FixedRuler( 100.0f );
924 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
925 RulerPtr rulerY = new FixedRuler( 100.0f );
926 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
928 scrollView.SetRulerX( rulerX );
929 scrollView.SetRulerY( rulerY );
931 scrollView.ScrollTo( Vector2(120.0f, 190.0f), 0.0f );
933 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(120.0f, 190.0f), TEST_LOCATION );
935 scrollView.ScrollToSnapPoint();
937 Wait(application, RENDER_DELAY_SCROLL);
938 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 200.0f), TEST_LOCATION );
942 int UtcDaliToolkitScrollViewSetScrollUpdateDistanceP(void)
944 ToolkitTestApplication application;
945 tet_infoline(" UtcDaliToolkitScrollViewSetScrollUpdateDistanceP");
947 ScrollView scrollView = ScrollView::New();
949 scrollView.SetScrollUpdateDistance(0);
950 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 0, TEST_LOCATION);
951 scrollView.SetScrollUpdateDistance(10);
952 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 10, TEST_LOCATION);
953 scrollView.SetScrollUpdateDistance(1000);
954 DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 1000, TEST_LOCATION);
958 int UtcDaliToolkitScrollViewSetWrapModeP(void)
960 ToolkitTestApplication application;
961 tet_infoline(" UtcDaliToolkitScrollViewSetWrapModeP");
963 ScrollView scrollView = ScrollView::New();
964 Stage::GetCurrent().Add( scrollView );
966 Actor actor = Actor::New();
967 scrollView.Add( actor );
969 // Position rulers. 4x4 grid.
970 RulerPtr rulerX = new FixedRuler(50.0f);
971 RulerPtr rulerY = new FixedRuler(50.0f);
972 rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) );
973 rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) );
974 scrollView.SetRulerX(rulerX);
975 scrollView.SetRulerY(rulerY);
977 scrollView.SetWrapMode(false);
978 scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
980 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
982 scrollView.SetWrapMode(true);
983 scrollView.ScrollTo(Vector2(230.0f, 130.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
985 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 13, TEST_LOCATION );
989 int UtcDaliToolkitScrollViewActorAutoSnap(void)
991 ToolkitTestApplication application;
992 tet_infoline(" UtcDaliToolkitScrollViewActorAutoSnap");
994 ScrollView scrollView = ScrollView::New();
995 Stage::GetCurrent().Add( scrollView );
998 RulerPtr rulerX = new DefaultRuler();
999 RulerPtr rulerY = new DefaultRuler();
1000 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1001 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1002 scrollView.SetRulerX(rulerX);
1003 scrollView.SetRulerY(rulerY);
1005 const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f);
1006 Actor a = Actor::New();
1008 a.SetPosition(aPosition);
1010 const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f);
1011 Actor b = Actor::New();
1013 b.SetPosition(bPosition);
1015 // Goto a random position, and execute snap (should not move)
1016 Vector2 targetScroll = Vector2(500.0f, 500.0f);
1017 scrollView.ScrollTo(targetScroll, 0.0f);
1019 scrollView.ScrollToSnapPoint();
1020 Wait(application, RENDER_DELAY_SCROLL);
1021 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION );
1023 // Enable ActorAutoSnap, and now try snapping.
1024 scrollView.SetActorAutoSnap(true);
1025 scrollView.ScrollToSnapPoint();
1026 Wait(application, RENDER_DELAY_SCROLL);
1027 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition.GetVectorXY(), TEST_LOCATION );
1029 scrollView.ScrollTo(Vector2(0.0f, 0.0f), 0.0f);
1031 scrollView.ScrollToSnapPoint();
1032 Wait(application, RENDER_DELAY_SCROLL);
1033 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition.GetVectorXY(), TEST_LOCATION );
1037 int UtcDaliToolkitScrollViewSignalsStartComplete(void)
1039 ToolkitTestApplication application;
1040 tet_infoline(" UtcDaliToolkitScrollViewSignalsStartComplete");
1042 gOnScrollStartCalled = false;
1043 gOnScrollCompleteCalled = false;
1045 ScrollView scrollView = ScrollView::New();
1046 Stage::GetCurrent().Add( scrollView );
1049 RulerPtr rulerX = new DefaultRuler();
1050 RulerPtr rulerY = new DefaultRuler();
1051 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1052 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1053 scrollView.SetRulerX(rulerX);
1054 scrollView.SetRulerY(rulerY);
1055 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1056 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1057 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1058 scrollView.ScrollTo( Vector2(100.0f, 100.0f) );
1059 Wait(application, RENDER_DELAY_SCROLL);
1061 DALI_TEST_CHECK(gOnScrollStartCalled);
1062 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1066 int UtcDaliToolkitScrollViewSignalsUpdate01(void)
1068 ToolkitTestApplication application;
1069 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1071 gOnScrollStartCalled = false;
1072 gOnScrollUpdateCalled = false;
1073 gOnScrollCompleteCalled = false;
1075 ScrollView scrollView = ScrollView::New();
1076 Stage::GetCurrent().Add( scrollView );
1077 Vector2 stageSize = Stage::GetCurrent().GetSize();
1078 scrollView.SetSize(stageSize);
1079 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1080 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1083 RulerPtr rulerX = new DefaultRuler();
1084 RulerPtr rulerY = new DefaultRuler();
1085 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1086 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1087 scrollView.SetRulerX(rulerX);
1088 scrollView.SetRulerY(rulerY);
1089 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1090 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1091 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1093 Actor image = Actor::New();
1094 image.SetSize(stageSize);
1095 image.SetParentOrigin(ParentOrigin::TOP_LEFT);
1096 image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1097 scrollView.Add(image);
1101 // Do a pan starting from 100,100 and moving down diagonally.
1102 Vector2 pos(100.0f, 100.0f);
1103 SendPan(application, Gesture::Possible, pos);
1104 SendPan(application, Gesture::Started, pos);
1107 Wait(application, 100);
1109 for(int i = 0;i<20;i++)
1111 SendPan(application, Gesture::Continuing, pos);
1117 SendPan(application, Gesture::Finished, pos);
1118 Wait(application, RENDER_DELAY_SCROLL);
1120 DALI_TEST_CHECK(gOnScrollStartCalled);
1121 DALI_TEST_CHECK(gOnScrollUpdateCalled);
1122 DALI_TEST_CHECK(gOnScrollCompleteCalled);
1126 int UtcDaliToolkitScrollViewSignalsUpdate02(void)
1128 ToolkitTestApplication application;
1129 tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
1131 gOnScrollStartCalled = false;
1132 gOnScrollUpdateCalled = false;
1133 gOnScrollCompleteCalled = false;
1135 ScrollView scrollView = ScrollView::New();
1136 Stage::GetCurrent().Add( scrollView );
1137 Vector2 stageSize = Stage::GetCurrent().GetSize();
1138 scrollView.SetSize(stageSize);
1139 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1140 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1143 RulerPtr rulerX = new DefaultRuler();
1144 RulerPtr rulerY = new DefaultRuler();
1145 rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1146 rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
1147 scrollView.SetRulerX(rulerX);
1148 scrollView.SetRulerY(rulerY);
1149 Dali::ConnectionTracker tracker;
1150 bool scrollStarted=false;
1151 bool scrollUpdated=false;
1152 bool scrollCompleted=false;
1153 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) ));
1154 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) ));
1155 DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) ));
1157 Actor image = Actor::New();
1158 image.SetSize(stageSize);
1159 image.SetParentOrigin(ParentOrigin::TOP_LEFT);
1160 image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1161 scrollView.Add(image);
1165 // Do a pan starting from 100,100 and moving down diagonally.
1166 Vector2 pos(100.0f, 100.0f);
1167 SendPan(application, Gesture::Possible, pos);
1168 SendPan(application, Gesture::Started, pos);
1171 Wait(application, 100);
1173 for(int i = 0;i<20;i++)
1175 SendPan(application, Gesture::Continuing, pos);
1181 SendPan(application, Gesture::Finished, pos);
1182 Wait(application, RENDER_DELAY_SCROLL);
1184 DALI_TEST_CHECK(scrollStarted);
1185 DALI_TEST_CHECK(scrollUpdated);
1186 DALI_TEST_CHECK(scrollCompleted);
1188 Stage::GetCurrent().Remove( scrollView );
1193 int UtcDaliToolkitScrollViewScrollSensitive(void)
1195 ToolkitTestApplication application;
1196 tet_infoline(" UtcDaliToolkitScrollViewScrollSensitive");
1198 // Set up a scrollView...
1199 ScrollView scrollView = ScrollView::New();
1200 scrollView.SetOvershootEnabled(true);
1201 Stage::GetCurrent().Add( scrollView );
1202 Vector2 stageSize = Stage::GetCurrent().GetSize();
1203 scrollView.SetSize(stageSize);
1204 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1205 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1208 RulerPtr rulerX = new DefaultRuler();
1209 RulerPtr rulerY = new DefaultRuler();
1210 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1211 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1212 scrollView.SetRulerX(rulerX);
1213 scrollView.SetRulerY(rulerY);
1214 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1215 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1216 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1217 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1219 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1222 // First try insensitive swipe.
1223 scrollView.SetScrollSensitive(false);
1224 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1226 DALI_TEST_CHECK( !gOnScrollStartCalled );
1227 DALI_TEST_CHECK( !gOnScrollCompleteCalled );
1228 DALI_TEST_CHECK( !gOnSnapStartCalled );
1230 // Second try sensitive swipe.
1231 scrollView.SetScrollSensitive(true);
1232 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1234 DALI_TEST_CHECK( gOnScrollStartCalled );
1235 DALI_TEST_CHECK( gOnScrollCompleteCalled );
1236 DALI_TEST_CHECK( gOnSnapStartCalled );
1240 int UtcDaliToolkitScrollViewAxisAutoLock(void)
1242 ToolkitTestApplication application;
1243 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLock");
1245 // Set up a scrollView...
1246 ScrollView scrollView = ScrollView::New();
1247 Stage::GetCurrent().Add( scrollView );
1248 Vector2 stageSize = Stage::GetCurrent().GetSize();
1249 scrollView.SetSize(stageSize);
1250 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1251 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1254 RulerPtr rulerX = new DefaultRuler();
1255 RulerPtr rulerY = new DefaultRuler();
1256 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1257 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1258 scrollView.SetRulerX(rulerX);
1259 scrollView.SetRulerY(rulerY);
1260 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1261 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1262 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1265 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1267 Vector2 startPosition = scrollView.GetCurrentScrollPosition();
1268 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1269 const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
1272 scrollView.SetAxisAutoLock(true);
1273 DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
1275 scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1277 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1278 const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
1280 // compare how much the Y position has deviated for normal and autolock.
1281 const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
1282 const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
1284 // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
1285 DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
1287 scrollView.SetAxisAutoLock(false);
1288 DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
1292 int UtcDaliToolkitScrollViewAxisAutoLockGradient(void)
1294 ToolkitTestApplication application;
1295 tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLockGradient");
1297 // Set up a scrollView...
1298 ScrollView scrollView = ScrollView::New();
1299 scrollView.SetAxisAutoLockGradient(0.5f);
1300 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
1301 scrollView.SetAxisAutoLockGradient(1.0f);
1302 DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
1306 int UtcDaliToolkitScrollViewConstraints(void)
1308 ToolkitTestApplication application;
1309 tet_infoline(" UtcDaliToolkitScrollViewConstraints");
1311 // Set up a scrollView...
1312 ScrollView scrollView = ScrollView::New();
1313 Stage::GetCurrent().Add( scrollView );
1314 Vector2 stageSize = Stage::GetCurrent().GetSize();
1315 scrollView.SetSize(stageSize);
1316 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1317 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1320 RulerPtr rulerX = new DefaultRuler();
1321 RulerPtr rulerY = new DefaultRuler();
1322 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1323 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1324 scrollView.SetRulerX(rulerX);
1325 scrollView.SetRulerY(rulerY);
1327 // Add an Actor to ScrollView,
1328 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1329 gConstraintResult = Vector3::ZERO;
1330 Actor a = Actor::New();
1332 a.SetPosition( TEST_ACTOR_POSITION );
1335 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1336 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1337 constraint.SetRemoveAction(Constraint::Discard);
1338 scrollView.ApplyConstraintToChildren(constraint);
1341 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1343 gConstraintResult = Vector3::ZERO;
1344 scrollView.RemoveConstraintsFromChildren();
1347 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1351 int UtcDaliToolkitScrollViewBind(void)
1353 ToolkitTestApplication application;
1354 tet_infoline(" UtcDaliToolkitScrollViewBind");
1356 // Set up a scrollView...
1357 ScrollView scrollView = ScrollView::New();
1358 Stage::GetCurrent().Add( scrollView );
1359 Vector2 stageSize = Stage::GetCurrent().GetSize();
1360 scrollView.SetSize(stageSize);
1361 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1362 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1365 RulerPtr rulerX = new DefaultRuler();
1366 RulerPtr rulerY = new DefaultRuler();
1367 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1368 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1369 scrollView.SetRulerX(rulerX);
1370 scrollView.SetRulerY(rulerY);
1372 // Add an Actor to ScrollView,
1373 // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1375 gConstraintResult = Vector3::ZERO;
1376 Actor a = Actor::New();
1378 a.SetPosition( TEST_ACTOR_POSITION );
1381 // apply this constraint to scrollview
1382 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1383 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1384 constraint.SetRemoveAction(Constraint::Discard);
1385 scrollView.ApplyConstraintToChildren(constraint);
1389 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1392 gConstraintResult = Vector3::ZERO;
1393 scrollView.UnbindActor( a );
1395 DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1398 gConstraintResult = Vector3::ZERO;
1399 scrollView.BindActor( a );
1401 DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1405 int UtcDaliToolkitScrollViewOvershoot(void)
1407 ToolkitTestApplication application;
1408 tet_infoline(" UtcDaliToolkitScrollViewOvershoot");
1410 // Set up a scrollView...
1411 ScrollView scrollView = ScrollView::New();
1412 scrollView.SetOvershootEnabled(true);
1414 Vector2 overshootSize = Vector2(100.0f,100.0f);
1415 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
1416 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
1418 Stage::GetCurrent().Add( scrollView );
1419 Vector2 stageSize = Stage::GetCurrent().GetSize();
1420 scrollView.SetSize(stageSize);
1421 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1422 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1425 RulerPtr rulerX = new DefaultRuler();
1426 RulerPtr rulerY = new DefaultRuler();
1427 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1428 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1429 scrollView.SetRulerX(rulerX);
1430 scrollView.SetRulerY(rulerY);
1431 scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1432 scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1433 scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1435 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1438 // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
1439 Vector2 currentPos = Vector2(100.0f, 100.0f);
1440 currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
1441 float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1442 float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1443 Vector2 positionValue = scrollView.GetCurrentProperty< Vector2 >( ScrollView::Property::SCROLL_POSITION );
1444 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1445 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1446 DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION);
1448 float timeToReachOrigin;
1450 // Now release touch. Overshoot should snap back to zero.
1451 SendPan(application, Gesture::Finished, currentPos);
1452 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1454 float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1455 float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1457 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1458 (timeToReachOrigin < maxTimeToReachOrigin) );
1460 // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
1461 scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
1463 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1464 // Now release touch. Overshoot should snap back to zero.
1465 SendPan(application, Gesture::Finished, currentPos);
1466 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1468 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1469 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1471 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1472 (timeToReachOrigin < maxTimeToReachOrigin) );
1474 // 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
1475 scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
1477 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1478 // Now release touch. Overshoot should snap back to zero.
1479 SendPan(application, Gesture::Finished, currentPos);
1480 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1482 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1483 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1485 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1486 (timeToReachOrigin < maxTimeToReachOrigin) );
1488 // 4. Repeat Scroll, but this time change overshoot function.
1489 scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
1490 scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
1492 currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1493 // Now release touch. Overshoot should snap back to zero.
1494 SendPan(application, Gesture::Finished, currentPos);
1495 timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1497 minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1498 maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1500 DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1501 (timeToReachOrigin < maxTimeToReachOrigin) );
1505 int UtcDaliToolkitScrollViewSnapAlphaFunction(void)
1507 ToolkitTestApplication application;
1508 tet_infoline(" UtcDaliToolkitScrollViewSnapAlphaFunction");
1510 // Set up a scrollView...
1511 ScrollView scrollView = ScrollView::New();
1512 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_IN );
1513 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_IN );
1514 scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_OUT );
1515 DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_OUT );
1517 scrollView.SetScrollFlickAlphaFunction( AlphaFunction::BOUNCE );
1518 DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction().GetBuiltinFunction() == AlphaFunction::BOUNCE );
1523 int UtcDaliToolkitScrollViewSnapDuration(void)
1525 ToolkitTestApplication application;
1526 tet_infoline(" UtcDaliToolkitScrollViewSnapDuration");
1528 // Set up a scrollView...
1529 ScrollView scrollView = ScrollView::New();
1530 scrollView.SetScrollSnapDuration( 1.0f );
1531 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION );
1532 scrollView.SetScrollSnapDuration( 0.5f );
1533 DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION );
1535 scrollView.SetScrollFlickDuration( 2.0f );
1536 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION );
1537 scrollView.SetScrollFlickDuration( 1.5f );
1538 DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION );
1542 int UtcDaliToolkitScrollViewSnapStartedSignalP(void)
1544 ToolkitTestApplication application;
1545 tet_infoline(" UtcDaliToolkitScrollViewSnapStartedSignalP");
1547 // Set up a scrollView...
1548 ScrollView scrollView = ScrollView::New();
1549 Stage::GetCurrent().Add( scrollView );
1550 Vector2 stageSize = Stage::GetCurrent().GetSize();
1551 scrollView.SetSize(stageSize);
1552 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1553 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1556 RulerPtr rulerX = new DefaultRuler();
1557 RulerPtr rulerY = new DefaultRuler();
1558 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1559 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1560 scrollView.SetRulerX(rulerX);
1561 scrollView.SetRulerY(rulerY);
1562 scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1564 scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1567 // First try a snap.
1568 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true);
1570 DALI_TEST_CHECK( gOnSnapStartCalled );
1571 DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
1573 // Second try a swipe.
1574 PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true);
1576 DALI_TEST_CHECK( gOnSnapStartCalled );
1577 DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
1581 int UtcDaliToolkitScrollViewGetCurrentPageP(void)
1583 ToolkitTestApplication application;
1584 tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP");
1586 ScrollView scrollView = ScrollView::New();
1587 Stage::GetCurrent().Add( scrollView );
1588 RulerPtr rulerX = new FixedRuler( 100.0f );
1589 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1590 RulerPtr rulerY = new FixedRuler( 100.0f );
1591 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1593 scrollView.SetRulerX( rulerX );
1594 scrollView.SetRulerY( rulerY );
1596 scrollView.ScrollTo( 15 );
1597 Wait(application, RENDER_DELAY_SCROLL);
1598 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
1600 scrollView.ScrollTo( 3 );
1601 Wait(application, RENDER_DELAY_SCROLL);
1602 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
1604 scrollView.ScrollTo( 9 );
1605 Wait(application, RENDER_DELAY_SCROLL);
1606 DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
1611 int UtcDaliToolkitScrollViewSetMaxOvershootP(void)
1613 ToolkitTestApplication application;
1614 tet_infoline(" UtcDaliToolkitScrollViewSetMaxOvershootP");
1616 // Set up a scrollView...
1617 ScrollView scrollView = ScrollView::New();
1618 Stage::GetCurrent().Add( scrollView );
1619 Vector2 stageSize = Stage::GetCurrent().GetSize();
1620 scrollView.SetSize(stageSize);
1621 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1622 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1625 RulerPtr rulerX = new DefaultRuler();
1626 RulerPtr rulerY = new DefaultRuler();
1627 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1628 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1629 scrollView.SetRulerX(rulerX);
1630 scrollView.SetRulerY(rulerY);
1632 // Set the max overshoot to be 50 pixels in both X axis and Y axis
1633 scrollView.SetMaxOvershoot(50.0f, 50.0f);
1635 scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1638 // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
1639 Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false);
1640 float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1641 float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1642 DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
1643 DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
1645 // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
1646 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false);
1647 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1648 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1649 // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
1650 // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
1651 float correctOvershootValue = 50.0f / 105.f;
1652 DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1653 DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1655 // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1656 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1657 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1658 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1659 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1660 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1662 // Change the max overshoot to be 100 pixels in both X axis and Y axis
1663 scrollView.SetMaxOvershoot(100.0f, 100.0f);
1666 // Check that overshoot should be now around 0.8.
1667 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1668 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1669 DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
1670 DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
1672 // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1673 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1674 overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X );
1675 overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y );
1676 DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1677 DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1682 int UtcDaliToolkitScrollViewSetScrollingDirectionP(void)
1684 ToolkitTestApplication application;
1685 tet_infoline(" UtcDaliToolkitScrollViewSetScrollingDirectionP");
1687 // Set up a scrollView...
1688 ScrollView scrollView = ScrollView::New();
1689 Stage::GetCurrent().Add( scrollView );
1690 Vector2 stageSize = Stage::GetCurrent().GetSize();
1691 scrollView.SetSize(stageSize);
1692 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1693 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1695 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1697 scrollView.ScrollTo(START_POSITION, 0.0f);
1699 // Try a vertical swipe.
1700 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1701 // Take into account resampling done when prediction is off.
1702 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1704 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1706 scrollView.ScrollTo(START_POSITION, 0.0f);
1708 // Try a vertical swipe.
1709 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1710 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1712 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1714 scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1716 // Try a vertical swipe.
1717 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1718 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1723 int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void)
1725 ToolkitTestApplication application;
1726 tet_infoline(" UtcDaliToolkitScrollViewRemoveScrollingDirectionP");
1728 // Set up a scrollView...
1729 ScrollView scrollView = ScrollView::New();
1730 Stage::GetCurrent().Add( scrollView );
1731 Vector2 stageSize = Stage::GetCurrent().GetSize();
1732 scrollView.SetSize(stageSize);
1733 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1734 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1736 Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1738 scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1740 scrollView.ScrollTo(START_POSITION, 0.0f);
1742 // Try a vertical swipe.
1743 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1744 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1746 scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1748 scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1750 // Try a vertical swipe.
1751 PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1752 // Take into account resampling done when prediction is off.
1753 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1758 int UtcDaliToolkitScrollViewSetRulerXP(void)
1760 ToolkitTestApplication application;
1761 tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP");
1763 ScrollView scrollView = ScrollView::New();
1764 Stage::GetCurrent().Add( scrollView );
1765 RulerPtr rulerX = new FixedRuler( 100.0f );
1766 rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1768 scrollView.SetRulerX( rulerX );
1770 scrollView.ScrollTo( 1, 0.0f );
1772 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
1774 RulerPtr newRulerX = new FixedRuler( 200.0f );
1775 newRulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1777 scrollView.SetRulerX( newRulerX );
1779 scrollView.ScrollTo( 1, 0.0f );
1781 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 0.0f), TEST_LOCATION );
1786 int UtcDaliToolkitScrollViewSetRulerYP(void)
1788 ToolkitTestApplication application;
1789 tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP");
1791 ScrollView scrollView = ScrollView::New();
1792 Stage::GetCurrent().Add( scrollView );
1794 RulerPtr rulerY = new FixedRuler( 200.0f );
1795 rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1797 scrollView.SetRulerY( rulerY );
1799 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1801 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 350.0f), TEST_LOCATION );
1803 RulerPtr newRulerY = new FixedRuler( 100.0f );
1804 newRulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
1805 scrollView.SetRulerY( newRulerY );
1807 scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1809 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 200.0f), TEST_LOCATION );
1814 int UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP(void)
1816 ToolkitTestApplication application;
1817 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP");
1819 ScrollView scrollView = ScrollView::New();
1820 scrollView.SetMinimumSpeedForFlick(25.0f);
1821 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 25.0f, TEST_LOCATION );
1822 scrollView.SetMinimumSpeedForFlick(60.0f);
1823 DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 60.0f, TEST_LOCATION );
1827 int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void)
1829 ToolkitTestApplication application;
1830 tet_infoline(" UtcDaliToolkitScrollViewSetMinimumDistanceForFlick");
1832 ScrollView scrollView = ScrollView::New();
1834 scrollView.SetMinimumDistanceForFlick(Vector2(30.0f, 15.0f));
1835 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1836 scrollView.SetMinimumDistanceForFlick(Vector2(60.0f, 30.0f));
1837 DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1841 int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void)
1843 ToolkitTestApplication application;
1844 tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP");
1846 ScrollView scrollView = ScrollView::New();
1847 // Disable Refresh signal (TET environment cannot use adaptor's Timer)
1848 scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
1849 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1850 scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
1851 DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1855 int UtcDaliToolkitScrollViewApplyEffectP(void)
1857 ToolkitTestApplication application;
1858 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectP");
1860 // Create a ScrollView
1861 ScrollView scrollView = ScrollView::New();
1863 // Create two scroll view effects
1864 Dali::Path path = Dali::Path::New();
1865 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);
1866 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);
1868 // Apply both effects
1869 scrollView.ApplyEffect(effect);
1870 scrollView.ApplyEffect(newEffect);
1872 DALI_TEST_CHECK( true );
1877 int UtcDaliToolkitScrollViewApplyEffectN(void)
1879 ToolkitTestApplication application;
1880 tet_infoline(" UtcDaliToolkitScrollViewApplyEffectN");
1882 // Create a ScrollView
1883 ScrollView scrollView = ScrollView::New();
1885 // Create two scroll view effects
1886 Dali::Path path = Dali::Path::New();
1887 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);
1888 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);
1890 // Apply both effects
1891 scrollView.ApplyEffect(effect);
1892 scrollView.ApplyEffect(newEffect);
1894 // Attempt to apply the same effect again
1897 scrollView.ApplyEffect(newEffect);
1898 tet_result( TET_FAIL );
1900 catch ( DaliException& e )
1902 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1908 int UtcDaliToolkitScrollViewRemoveEffectP(void)
1910 ToolkitTestApplication application;
1911 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectP");
1913 // Create a ScrollView
1914 ScrollView scrollView = ScrollView::New();
1916 // Create two scroll view effects
1917 Dali::Path path = Dali::Path::New();
1918 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);
1919 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);
1921 // Apply both effects
1922 scrollView.ApplyEffect(effect);
1923 scrollView.ApplyEffect(newEffect);
1925 // Remove both effects
1926 scrollView.RemoveEffect(effect);
1927 scrollView.RemoveEffect(newEffect);
1929 DALI_TEST_CHECK( true );
1934 int UtcDaliToolkitScrollViewRemoveEffectN(void)
1936 ToolkitTestApplication application;
1937 tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectN");
1939 // Create a ScrollView
1940 ScrollView scrollView = ScrollView::New();
1942 // Create two scroll view effects
1943 Dali::Path path = Dali::Path::New();
1944 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);
1945 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);
1947 // Apply the first effect
1948 scrollView.ApplyEffect(effect);
1950 // Attempt to remove the second effect which has not been applied to scroll view
1953 scrollView.RemoveEffect(newEffect);
1954 tet_result( TET_FAIL );
1956 catch ( DaliException& e )
1958 DALI_TEST_ASSERT( e, "effectExistedInScrollView", TEST_LOCATION );
1964 int UtcDaliToolkitScrollViewRemoveAllEffectsP(void)
1966 ToolkitTestApplication application;
1967 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsP");
1969 // Create a ScrollView
1970 ScrollView scrollView = ScrollView::New();
1972 // Create two scroll view effects
1973 Dali::Path path = Dali::Path::New();
1974 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);
1975 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);
1977 // Apply both effects
1978 scrollView.ApplyEffect(effect);
1979 scrollView.ApplyEffect(newEffect);
1981 // Attempt to apply the same first effect again
1984 scrollView.ApplyEffect(effect);
1985 tet_result( TET_FAIL );
1987 catch ( DaliException& e )
1989 DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1992 // Remove both effects
1993 scrollView.RemoveAllEffects();
1995 // Apply both effects again
1996 scrollView.ApplyEffect(effect);
1997 scrollView.ApplyEffect(newEffect);
1999 DALI_TEST_CHECK( true );
2004 int UtcDaliToolkitScrollViewRemoveAllEffectsN(void)
2006 ToolkitTestApplication application;
2007 tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsN");
2009 // Create a ScrollView
2010 ScrollView scrollView = ScrollView::New();
2012 // Remove effects when there is no effect applied previously
2013 scrollView.RemoveAllEffects();
2015 DALI_TEST_CHECK( true );
2020 int UtcDaliToolkitScrollViewSetOvershootEnabledP(void)
2022 ToolkitTestApplication application;
2023 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEnabledP");
2025 ScrollView scrollView = ScrollView::New();
2027 scrollView.SetOvershootEnabled(true);
2028 DALI_TEST_CHECK(scrollView.IsOvershootEnabled());
2030 scrollView.SetOvershootEnabled(false);
2031 DALI_TEST_CHECK(!scrollView.IsOvershootEnabled());
2036 int UtcDaliToolkitScrollViewSetOvershootEffectColorP(void)
2038 ToolkitTestApplication application;
2039 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEffectColorP");
2041 ScrollView scrollView = ScrollView::New();
2043 scrollView.SetOvershootEffectColor(Dali::Color::RED);
2044 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::RED, TEST_LOCATION);
2046 scrollView.SetOvershootEffectColor(Dali::Color::YELLOW);
2047 DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::YELLOW, TEST_LOCATION);
2052 int UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP(void)
2054 ToolkitTestApplication application;
2055 tet_infoline(" UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP");
2057 ScrollView scrollView = ScrollView::New();
2059 scrollView.SetOvershootAnimationSpeed(55.0f);
2060 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 55.0f, TEST_LOCATION);
2062 scrollView.SetOvershootAnimationSpeed(120.0f);
2063 DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 120.0f, TEST_LOCATION);
2068 int UtcDaliToolkitScrollViewGetSet(void)
2070 ToolkitTestApplication application;
2071 tet_infoline(" UtcDaliToolkitScrollViewGetSet");
2072 ScrollView scrollView = ScrollView::New();
2073 scrollView.SetMaxFlickSpeed(0.5f);
2074 DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2075 scrollView.SetFrictionCoefficient(0.6f);
2076 DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2077 scrollView.SetFlickSpeedCoefficient(0.7f);
2078 DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
2082 int UtcDaliToolkitScrollViewRulerDomainConstructorP(void)
2084 ToolkitTestApplication application;
2086 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2087 DALI_TEST_EQUALS( domainX.min, 0.0f, TEST_LOCATION);
2088 DALI_TEST_EQUALS( domainX.max, 200.0f, TEST_LOCATION);
2089 DALI_TEST_EQUALS( domainX.enabled, true, TEST_LOCATION);
2091 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2092 DALI_TEST_EQUALS( domainY.min, 100.0f, TEST_LOCATION);
2093 DALI_TEST_EQUALS( domainY.max, 500.0f, TEST_LOCATION);
2094 DALI_TEST_EQUALS( domainY.enabled, false, TEST_LOCATION);
2099 int UtcDaliToolkitScrollViewRulerDomainGetSizeP(void)
2101 ToolkitTestApplication application;
2103 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2104 DALI_TEST_EQUALS( domainX.GetSize(), 200.0f, TEST_LOCATION);
2106 RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
2107 DALI_TEST_EQUALS( domainY.GetSize(), 400.0f, TEST_LOCATION);
2112 int UtcDaliToolkitScrollViewRulerDomainClampP(void)
2114 ToolkitTestApplication application;
2116 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2118 float value = domainX.Clamp(50.0f, 100.0f, 1.0f);
2119 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2121 value = domainX.Clamp(300.0f, 20.0f, 1.0f);
2122 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2124 value = domainX.Clamp(300.0f, 20.0f, 0.5f);
2125 DALI_TEST_EQUALS( value, 80.0f, TEST_LOCATION);
2127 value = domainX.Clamp(250.0f, 200.0f, 2.0f);
2128 DALI_TEST_EQUALS( value, 200.0f, TEST_LOCATION);
2133 int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void)
2135 ToolkitTestApplication application;
2137 RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
2140 float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped);
2141 DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
2142 DALI_TEST_EQUALS( clamped, Dali::Toolkit::NotClamped, TEST_LOCATION);
2144 value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped);
2145 DALI_TEST_EQUALS( value, 0.0f, TEST_LOCATION);
2146 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMin, TEST_LOCATION);
2148 value = domainX.Clamp(300.0f, 20.0f, 1.0f, clamped);
2149 DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
2150 DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMax, TEST_LOCATION);
2155 int UtcDaliToolkitScrollViewDefaultRulerConstructorP(void)
2157 ToolkitTestApplication application;
2158 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerConstructorP");
2160 RulerPtr defaultRuler = new DefaultRuler();
2161 DALI_TEST_CHECK( defaultRuler );
2166 int UtcDaliToolkitScrollViewDefaultRulerDestructorP(void)
2168 ToolkitTestApplication application;
2169 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerDestructorP");
2171 RulerPtr defaultRuler = new DefaultRuler();
2173 DALI_TEST_CHECK( true );
2177 int UtcDaliToolkitScrollViewFixedRulerConstructorP(void)
2179 ToolkitTestApplication application;
2180 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerConstructorP");
2182 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2183 DALI_TEST_CHECK( fixedRuler );
2185 fixedRuler = new FixedRuler( 0.0f );
2186 DALI_TEST_CHECK( fixedRuler );
2191 int UtcDaliToolkitScrollViewFixedRulerDestructorP(void)
2193 ToolkitTestApplication application;
2194 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerDestructorP");
2196 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2198 DALI_TEST_CHECK( true );
2202 int UtcDaliToolkitScrollViewRulerGetTypeP(void)
2204 ToolkitTestApplication application;
2205 tet_infoline(" UtcDaliToolkitScrollViewRulerGetTypeP");
2207 RulerPtr defaultRuler = new DefaultRuler();
2208 DALI_TEST_CHECK( defaultRuler );
2209 DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::Free, TEST_LOCATION);
2211 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2212 DALI_TEST_CHECK( fixedRuler );
2213 DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::Fixed, TEST_LOCATION);
2218 int UtcDaliToolkitScrollViewRulerGetExtensionP(void)
2220 ToolkitTestApplication application;
2221 tet_infoline(" UtcDaliToolkitScrollViewRulerGetExtensionP");
2223 RulerPtr defaultRuler = new DefaultRuler();
2224 DALI_TEST_CHECK( defaultRuler );
2225 DALI_TEST_CHECK( !defaultRuler->GetExtension() );
2227 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2228 DALI_TEST_CHECK( fixedRuler );
2229 DALI_TEST_CHECK( !fixedRuler->GetExtension() );
2234 int UtcDaliToolkitScrollViewRulerEnableDisable(void)
2236 ToolkitTestApplication application;
2237 tet_infoline(" UtcDaliToolkitScrollViewRulerEnableDisable");
2239 RulerPtr ruler = new DefaultRuler();
2241 DALI_TEST_CHECK( ruler->IsEnabled() );
2243 DALI_TEST_CHECK( !ruler->IsEnabled() );
2245 DALI_TEST_CHECK( ruler->IsEnabled() );
2249 int UtcDaliToolkitScrollViewRulerDomainEnableDisable(void)
2251 ToolkitTestApplication application;
2252 tet_infoline(" UtcDaliToolkitScrollViewRulerDomainEnableDisable");
2254 RulerPtr ruler = new DefaultRuler();
2255 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2257 ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) );
2258 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION );
2259 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION );
2260 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION );
2262 ruler->DisableDomain();
2263 DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2264 DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION );
2265 DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION );
2269 int UtcDaliToolkitScrollViewRulerSnapAndClamp(void)
2271 ToolkitTestApplication application;
2272 tet_infoline(" UtcDaliToolkitScrollViewRulerSnapAndClamp");
2274 RulerPtr ruler = new FixedRuler( 50.0f );
2275 ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2277 // default testing. (snap and clamp)
2278 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION);
2279 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION);
2280 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION);
2281 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION);
2282 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION);
2283 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION);
2286 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2287 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick
2288 DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2290 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2291 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick
2292 DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2295 DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary)
2296 DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary)
2297 DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary)
2298 DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary)
2299 DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary)
2302 DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION);
2303 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION);
2304 DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION);
2305 DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION);
2307 // clamp state testing.
2309 DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2310 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2311 DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2312 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2313 DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2314 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2315 DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2316 DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION );
2317 DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2318 DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2319 DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2320 DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION );
2324 int UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP(void)
2326 ToolkitTestApplication application;
2327 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP");
2329 RulerPtr rulerNormal = new FixedRuler( 25.0f );
2330 rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) );
2332 unsigned int volume;
2335 position = rulerNormal->GetPositionFromPage(1, volume, true);
2336 DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION );
2337 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2339 position = rulerNormal->GetPositionFromPage(2, volume, true);
2340 DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION );
2341 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2343 // Disable the ruler
2344 rulerNormal->Disable();
2346 position = rulerNormal->GetPositionFromPage(1, volume, true);
2347 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2348 DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION );
2350 position = rulerNormal->GetPositionFromPage(2, volume, true);
2351 DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2352 DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION );
2357 int UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP(void)
2359 ToolkitTestApplication application;
2360 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP");
2362 RulerPtr defaultRuler = new DefaultRuler();
2363 DALI_TEST_CHECK( defaultRuler );
2364 DALI_TEST_EQUALS( defaultRuler->GetTotalPages(), 1u, TEST_LOCATION);
2369 int UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP(void)
2371 ToolkitTestApplication application;
2372 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP");
2374 RulerPtr defaultRuler = new DefaultRuler();
2375 DALI_TEST_CHECK( defaultRuler );
2376 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(100.0f, true), 0u, TEST_LOCATION);
2377 DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(-300.0f, false), 0u, TEST_LOCATION);
2382 int UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP(void)
2384 ToolkitTestApplication application;
2385 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP");
2387 RulerPtr defaultRuler = new DefaultRuler();
2388 DALI_TEST_CHECK( defaultRuler );
2390 unsigned int volume;
2391 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(0, volume, true), 0.0f, TEST_LOCATION);
2392 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2394 DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(3, volume, false), 0.0f, TEST_LOCATION);
2395 DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2400 int UtcDaliToolkitScrollViewDefaultRulerSnapP(void)
2402 ToolkitTestApplication application;
2403 tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerSnapP");
2405 RulerPtr defaultRuler = new DefaultRuler();
2406 DALI_TEST_CHECK( defaultRuler );
2408 DALI_TEST_EQUALS( defaultRuler->Snap(50.0f, 0.5f), 50.0f, TEST_LOCATION);
2409 DALI_TEST_EQUALS( defaultRuler->Snap(-120.0f, 1.0f), -120.0f, TEST_LOCATION);
2414 int UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP(void)
2416 ToolkitTestApplication application;
2417 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP");
2419 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2420 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2422 fixedRuler->Enable();
2423 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 4u, TEST_LOCATION);
2425 fixedRuler->Disable();
2426 DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 1u, TEST_LOCATION);
2431 int UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP(void)
2433 ToolkitTestApplication application;
2434 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP");
2436 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2437 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2439 fixedRuler->Enable();
2440 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 3u, TEST_LOCATION);
2441 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2442 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 1u, TEST_LOCATION);
2443 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2445 fixedRuler->Disable();
2446 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2447 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2448 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2449 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2451 // Set domain size to be smaller than the ruler space
2452 fixedRuler->SetDomain( RulerDomain(0.0f, 50.0f, true) );
2454 fixedRuler->Enable();
2455 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2456 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2457 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2458 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2460 fixedRuler->Disable();
2461 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2462 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2463 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2464 DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2469 int UtcDaliToolkitScrollViewFixedRulerSnapP(void)
2471 ToolkitTestApplication application;
2472 tet_infoline(" UtcDaliToolkitScrollViewFixedRulerSnapP");
2474 RulerPtr fixedRuler = new FixedRuler( 100.0f );
2475 fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2477 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.0f), -100.0f, TEST_LOCATION);
2478 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.0f), -100.0f, TEST_LOCATION);
2479 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.0f), -200.0f, TEST_LOCATION);
2480 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.0f), -500.0f, TEST_LOCATION);
2481 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.0f), 0.0f, TEST_LOCATION);
2482 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.0f), 0.0f, TEST_LOCATION);
2483 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.0f), 0.0f, TEST_LOCATION);
2484 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.0f), 100.0f, TEST_LOCATION);
2485 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.0f), 100.0f, TEST_LOCATION);
2486 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.0f), 200.0f, TEST_LOCATION);
2487 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.0f), 600.0f, TEST_LOCATION);
2489 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.5f), 0.0f, TEST_LOCATION);
2490 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.5f), -100.0f, TEST_LOCATION);
2491 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.5f), -100.0f, TEST_LOCATION);
2492 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.5f), -500.0f, TEST_LOCATION);
2493 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.5f), 0.0f, TEST_LOCATION);
2494 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.5f), 100.0f, TEST_LOCATION);
2495 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.5f), 100.0f, TEST_LOCATION);
2496 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.5f), 100.0f, TEST_LOCATION);
2497 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.5f), 100.0f, TEST_LOCATION);
2498 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.5f), 300.0f, TEST_LOCATION);
2499 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.5f), 600.0f, TEST_LOCATION);
2501 DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 1.0f), 0.0f, TEST_LOCATION);
2502 DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 1.0f), 0.0f, TEST_LOCATION);
2503 DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 1.0f), -100.0f, TEST_LOCATION);
2504 DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 1.0f), -400.0f, TEST_LOCATION);
2505 DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 1.0f), 100.0f, TEST_LOCATION);
2506 DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 1.0f), 100.0f, TEST_LOCATION);
2507 DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 1.0f), 100.0f, TEST_LOCATION);
2508 DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 1.0f), 200.0f, TEST_LOCATION);
2509 DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 1.0f), 200.0f, TEST_LOCATION);
2510 DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 1.0f), 300.0f, TEST_LOCATION);
2511 DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 1.0f), 700.0f, TEST_LOCATION);
2516 int UtcDaliToolkitScrollViewConstraintsMove(void)
2518 ToolkitTestApplication application;
2519 tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove");
2521 // Set up a scrollView...
2522 ScrollView scrollView = ScrollView::New();
2523 Stage::GetCurrent().Add( scrollView );
2524 Vector2 stageSize = Stage::GetCurrent().GetSize();
2525 scrollView.SetSize(stageSize);
2526 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2527 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2530 RulerPtr rulerX = new DefaultRuler();
2531 RulerPtr rulerY = new DefaultRuler();
2532 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2533 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2534 scrollView.SetRulerX(rulerX);
2535 scrollView.SetRulerY(rulerY);
2537 // Add an Actor to ScrollView,
2538 Actor a = Actor::New();
2540 a.SetPosition( TEST_ACTOR_POSITION );
2543 const Vector2 target = Vector2(100.0f, 100.0f);
2544 const Vector2 target2 = Vector2(200.0f, 200.0f);
2546 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, MoveActorConstraint );
2547 constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
2548 constraint.SetRemoveAction(Constraint::Discard);
2549 scrollView.ApplyConstraintToChildren(constraint);
2551 scrollView.ScrollTo( target, 0.0f );
2553 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2554 scrollView.ScrollTo( target2 );
2555 Wait(application, RENDER_DELAY_SCROLL);
2556 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2561 int UtcDaliToolkitScrollViewConstraintsWrap(void)
2563 ToolkitTestApplication application;
2564 tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap");
2566 // Set up a scrollView...
2567 ScrollView scrollView = ScrollView::New();
2568 Stage::GetCurrent().Add( scrollView );
2569 Vector2 stageSize = Stage::GetCurrent().GetSize();
2570 scrollView.SetSize(stageSize);
2571 scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2572 scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2575 RulerPtr rulerX = new DefaultRuler();
2576 RulerPtr rulerY = new DefaultRuler();
2577 rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2578 rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2579 scrollView.SetRulerX(rulerX);
2580 scrollView.SetRulerY(rulerY);
2582 // Add an Actor to ScrollView,
2583 Actor a = Actor::New();
2585 a.SetPosition( TEST_ACTOR_POSITION );
2588 const Vector2 target = Vector2(100.0f, 100.0f);
2589 const Vector2 target2 = Vector2(200.0f, 200.0f);
2591 Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, WrapActorConstraint );
2592 constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
2593 constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
2594 constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
2595 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
2596 constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
2597 constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) );
2598 constraint.SetRemoveAction(Constraint::Discard);
2599 scrollView.ApplyConstraintToChildren(constraint);
2601 scrollView.ScrollTo( target, 0.0f );
2603 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2604 scrollView.ScrollTo( target2 );
2605 Wait(application, RENDER_DELAY_SCROLL);
2606 DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2608 scrollView.Remove(a);
2614 // Non-API test (so no P or N variant).
2615 int UtcDaliToolkitScrollViewGesturePageLimit(void)
2617 ToolkitTestApplication application;
2618 tet_infoline( " UtcDaliToolkitScrollViewGesturePageLimit" );
2620 // Set up a scrollView.
2621 ScrollView scrollView = ScrollView::New();
2623 // Do not rely on stage size for UTC tests.
2624 Vector2 pageSize( 720.0f, 1280.0f );
2625 scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
2626 scrollView.SetSize( pageSize );
2627 scrollView.SetParentOrigin( ParentOrigin::CENTER );
2628 scrollView.SetAnchorPoint( AnchorPoint::CENTER );
2629 scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
2632 // We set the X ruler to fixed to give us pages to snap to.
2633 Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( pageSize.width );
2634 // Note: The 3x page width is arbitary, but we need enough to show that we are
2635 // capping page movement by the page limiter, and not the domain.
2636 rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, pageSize.width * 3.0f, false ) );
2637 Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler();
2639 scrollView.SetRulerX( rulerX );
2640 scrollView.SetRulerY( rulerY );
2642 scrollView.SetWrapMode( false );
2643 scrollView.SetScrollSensitive( true );
2645 Stage::GetCurrent().Add( scrollView );
2647 // Set up a gesture to perform.
2648 Vector2 startPos( 50.0f, 0.0f );
2649 Vector2 direction( -5.0f, 0.0f );
2652 // Force starting position.
2653 scrollView.ScrollTo( startPos, 0.0f );
2654 Wait( application );
2656 // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
2657 Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
2659 // Confirm the final X coord has not moved more than one page from the start X position.
2660 DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
2662 // Finish the gesture and wait for the snap.
2663 currentPos += direction;
2664 SendPan( application, Gesture::Finished, currentPos );
2665 // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
2666 Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
2668 // Confirm the final X coord has snapped to exactly one page ahead of the start page.
2669 DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2674 int UtcDaliScrollViewSetGetProperty(void)
2676 ToolkitTestApplication application;
2678 // Create the ScrollView actor
2679 ScrollView scrollView = ScrollView::New();
2680 DALI_TEST_CHECK(scrollView);
2682 // Event side properties
2684 // Test "wrapEnabled" property
2685 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED );
2686 scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true );
2687 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get<bool>(), true, TEST_LOCATION );
2689 // Test "panningEnabled" property
2690 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED );
2691 scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false );
2692 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get<bool>(), false, TEST_LOCATION );
2694 // Test "axisAutoLockEnabled" property
2695 DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED );
2696 scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false );
2697 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get<bool>(), false, TEST_LOCATION );
2699 // Test "wheelScrollDistanceStep" property
2700 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP );
2701 scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) );
2702 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<Vector2>(), Vector2(100.0f, 50.0f), TEST_LOCATION );
2704 // Test "overshootEnabled" property
2705 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
2706 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), scrollView.IsOvershootEnabled(), TEST_LOCATION );
2707 scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
2708 DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
2710 // Animatable properties
2712 // Test "scrollPosition" property
2713 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION );
2714 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) );
2716 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get<Vector2>(), Vector2(320.0f, 550.0f), TEST_LOCATION );
2718 // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties
2719 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION );
2720 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) );
2722 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(300.0f, 500.0f), TEST_LOCATION );
2724 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X );
2725 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y );
2726 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 300.0f, TEST_LOCATION );
2727 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 500.0f, TEST_LOCATION );
2728 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f );
2729 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f );
2731 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 400.0f, TEST_LOCATION );
2732 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 600.0f, TEST_LOCATION );
2733 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(400.0f, 600.0f), TEST_LOCATION );
2735 // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties
2736 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX );
2737 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) );
2739 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(100.0f, 200.0f), TEST_LOCATION );
2741 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X );
2742 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y );
2743 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 100.0f, TEST_LOCATION );
2744 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 200.0f, TEST_LOCATION );
2745 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f );
2746 scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f );
2748 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 300.0f, TEST_LOCATION );
2749 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 400.0f, TEST_LOCATION );
2750 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(300.0f, 400.0f), TEST_LOCATION );
2752 // Test "overshootX" property
2753 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X );
2754 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f );
2756 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get<float>(), 0.8f, TEST_LOCATION );
2758 // Test "overshootY" property
2759 DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y );
2760 scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f );
2762 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get<float>(), 0.8f, TEST_LOCATION );
2764 // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties
2765 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL );
2766 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) );
2768 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(200.0f, 300.0f), TEST_LOCATION );
2770 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X );
2771 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y );
2772 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 200.0f, TEST_LOCATION );
2773 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 300.0f, TEST_LOCATION );
2774 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f );
2775 scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f );
2777 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 500.0f, TEST_LOCATION );
2778 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 600.0f, TEST_LOCATION );
2779 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(500.0f, 600.0f), TEST_LOCATION );
2781 // Test "wrap" property
2782 DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP );
2783 scrollView.SetProperty( ScrollView::Property::WRAP, false );
2785 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get<bool>(), false, TEST_LOCATION );
2787 // Test "panning" property
2788 DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING );
2789 scrollView.SetProperty( ScrollView::Property::PANNING, true );
2791 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get<bool>(), true, TEST_LOCATION );
2793 // Test "scrolling" property
2794 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING );
2795 scrollView.SetProperty( ScrollView::Property::SCROLLING, false );
2797 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get<bool>(), false, TEST_LOCATION );
2799 // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties
2800 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE );
2801 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) );
2803 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1200.0f, 1300.0f), TEST_LOCATION );
2805 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
2806 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
2807 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1200.0f, TEST_LOCATION );
2808 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1300.0f, TEST_LOCATION );
2809 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f );
2810 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f );
2812 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1500.0f, TEST_LOCATION );
2813 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1600.0f, TEST_LOCATION );
2814 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1500.0f, 1600.0f), TEST_LOCATION );
2816 // Test "scrollDomainOffset" property
2817 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET );
2818 scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) );
2820 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get<Vector2>(), Vector2(500.0f, 200.0f), TEST_LOCATION );
2822 // Test "scrollPositionDelta" property
2823 DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA );
2824 scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) );
2826 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get<Vector2>(), Vector2(10.0f, 30.0f), TEST_LOCATION );
2828 // Test "startPagePosition" property
2829 DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION );
2830 scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) );
2832 DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get<Vector3>(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION );