Merge "DALi Version 1.2.36" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ScrollView.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
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
25 using namespace Dali;
26 using namespace Toolkit;
27
28 void scroll_view_startup(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void scroll_view_cleanup(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 namespace
39 {
40 static bool gObjectCreatedCallBackCalled;
41
42 static void TestCallback(BaseHandle handle)
43 {
44   gObjectCreatedCallBackCalled = true;
45 }
46
47 struct CallbackFunctor
48 {
49   CallbackFunctor(bool* callbackFlag)
50   : mCallbackFlag( callbackFlag )
51   {
52   }
53
54   void operator()()
55   {
56     *mCallbackFlag = true;
57   }
58   bool* mCallbackFlag;
59 };
60
61 const int MILLISECONDS_PER_SECOND = 1000;
62 const int RENDER_FRAME_INTERVAL = 16;                           ///< Duration of each frame in ms. (at approx 60FPS)
63 const int RENDER_ANIMATION_TEST_DURATION_MS = 1000;             ///< 1000ms to test animation
64
65 const int RENDER_DELAY_SCROLL = 1000;                           ///< duration to wait for any scroll to complete.
66
67 // For Clamp Signal testing...
68 const float CLAMP_EXCESS_WIDTH = 200.0f;                        ///< Amount of width that can be panned outside scrollview
69 const float CLAMP_EXCESS_HEIGHT = 200.0f;                       ///< Amount of height that can be panned outside scrollview
70 const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0;                    ///< FSM: "First check that scrollview isn't clamped"
71 const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1;                  ///< FSM: "Next check that scrollview clamps against left side"
72 const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2;            ///< FSM: "Then check that scrollview clamps against bottom-left side"
73 const int CLAMP_STEP_3_SUCCESS = 3;                             ///< FSM: "Finished (Success)"
74 const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f);       ///< Scroll start position for the Clamping tests.
75 const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f );              ///< Start point to touch from for the Clamping tests.
76 const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f );              ///< Amount to move touch for each frame for the Clamping tests.
77 const int CLAMP_GESTURE_FRAMES = 100;                           ///< Number of Frames to synthesize a gesture for the Clamping tests.
78 const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f);        ///< A Test actor position offset (arbitrary value)
79 const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f);         ///< A Test constraint offset (arbitrary value to test effects)
80 const float TEST_RATIO_TOLERANCE = 0.05;                        ///< +/-5% tolerance for ratio comparisons.
81
82 const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f);                  ///< Default overshoot snapping animation time.
83 const float DEFAULT_MAX_OVERSHOOT(100.0f);                          ///< Default maximum allowed overshoot in pixels
84
85 const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600;                       ///< 10 seconds (at 60 frames per second).
86 const Vector2 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f);       ///< Scroll start position for the Overshoot tests.
87 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)
88 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).
89 const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f;           ///< a Test duration
90 const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f;            ///< another Test duration
91 const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
92 const float TIME_TOLERANCE = 0.05f;                                 ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
93
94
95 // Generate a PanGestureEvent to send to Core
96 Integration::PanGestureEvent GeneratePan(
97     Gesture::State state,
98     const Vector2& previousPosition,
99     const Vector2& currentPosition,
100     unsigned long timeDelta,
101     unsigned int numberOfTouches = 1)
102 {
103   Integration::PanGestureEvent pan(state);
104
105   pan.previousPosition = previousPosition;
106   pan.currentPosition = currentPosition;
107   pan.timeDelta = timeDelta;
108   pan.numberOfTouches = numberOfTouches;
109
110   return pan;
111 }
112
113 /**
114  * Helper to generate PanGestureEvent
115  *
116  * @param[in] application Application instance
117  * @param[in] state The Gesture State
118  * @param[in] pos The current position of touch.
119  */
120 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
121 {
122   static Vector2 last;
123
124   if( (state == Gesture::Started) ||
125       (state == Gesture::Possible) )
126   {
127     last.x = pos.x;
128     last.y = pos.y;
129   }
130
131   application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
132
133   last.x = pos.x;
134   last.y = pos.y;
135 }
136
137 /*
138  * Simulate time passed by.
139  *
140  * @note this will always process at least 1 frame (1/60 sec)
141  *
142  * @param application Test application instance
143  * @param duration Time to pass in milliseconds.
144  * @return The actual time passed in milliseconds
145  */
146 int Wait(ToolkitTestApplication& application, int duration = 0)
147 {
148   int time = 0;
149
150   for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
151   {
152     application.SendNotification();
153     application.Render(RENDER_FRAME_INTERVAL);
154     time += RENDER_FRAME_INTERVAL;
155   }
156
157   return time;
158 }
159
160 // Callback probes.
161
162 static bool gOnScrollStartCalled;                       ///< Whether the OnScrollStart signal was invoked.
163 static bool gOnScrollUpdateCalled;                      ///< Whether the OnScrollUpdate signal was invoked.
164 static bool gOnScrollCompleteCalled;                    ///< Whether the OnScrollComplete signal was invoked.
165 static bool gOnSnapStartCalled;                         ///< Whether the OnSnapStart signal was invoked.
166 static SnapType gLastSnapType;                          ///< Snaping information from SnapEvent.
167 static Vector3 gConstraintResult;                       ///< Result from constraint.
168
169 /**
170  * Invoked when scrolling starts.
171  *
172  * @param[in] position The current scroll position.
173  */
174 static void OnScrollStart( const Vector2& position )
175 {
176   gOnScrollStartCalled = true;
177 }
178
179 /**
180  * Invoked when scrolling updates (via dragging)
181  *
182  * @param[in] position The current scroll position.
183  */
184 static void OnScrollUpdate( const Vector2& position )
185 {
186   gOnScrollUpdateCalled = true;
187 }
188
189 /**
190  * Invoked when scrolling finishes
191  *
192  * @param[in] position The current scroll position.
193  */
194 static void OnScrollComplete( const Vector2& position )
195 {
196   gOnScrollCompleteCalled = true;
197 }
198
199 /**
200  * Invoked when a snap or flick started.
201  *
202  * @param[in] event The type of snap and the target position/scale/rotation.
203  */
204 static void OnSnapStart( const ScrollView::SnapEvent& event )
205 {
206   gOnSnapStartCalled = true;
207   gLastSnapType = event.type;
208 }
209
210 /**
211  * TestSumConstraint
212  *
213  * Summation of current value, property, and offset.
214  *
215  * current' = current + mOffset + property;
216  */
217 struct TestSumConstraint
218 {
219   /**
220    * @param[in] offset The offset to be added to current.
221    */
222   TestSumConstraint(const Vector3& offset)
223   :mOffset(offset)
224   {
225   }
226
227   /**
228    * @param[in] current The current base value
229    * @param[in] inputs Contains the property to be added to current.
230    * @return The new current Vector.
231    */
232   void operator()( Vector3& current, const PropertyInputContainer& inputs )
233   {
234     gConstraintResult = current + Vector3(inputs[0]->GetVector2()) + mOffset;
235     current = gConstraintResult;
236   }
237
238   Vector3 mOffset;
239
240 };
241
242 /**
243  * @param[in] application The application instance
244  * @param[in] scrollView The scrollView instance
245  * @return The time taken for the overshoot to reach origin (zero)
246  */
247 static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
248 {
249   int timeToReachOrigin = -1;
250   for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
251   {
252     float overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
253     float overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
254     if(overshootXValue == 0.0f && overshootYValue == 0.0f)
255     {
256       break;
257     }
258
259     timeToReachOrigin += Wait(application);
260   }
261
262   return static_cast<float>(timeToReachOrigin) * 0.001f; // return in seconds not ms.
263 }
264
265 /**
266  * y = 2x alpha function, which is clamped between 0.0f - 1.0f
267  *
268  * Animations should appear to finish (reach 100% point)
269  * at just half the time of a regular Linear AlphaFunction.
270  *
271  * @param[in] progress value (ranges from 0.0f - 1.0f)
272  * @return interpolation value (ranges from 0.0f - 1.0f)
273  */
274 float TestAlphaFunction(float progress)
275 {
276   return std::min( progress * 2.0f, 1.0f );
277 }
278
279 } // unnamed namespace
280
281
282 int UtcDaliToolkitScrollViewConstructorP(void)
283 {
284   ToolkitTestApplication application;
285
286   ScrollView scrollView;
287   DALI_TEST_CHECK( !scrollView );
288   END_TEST;
289 }
290
291 int UtcDaliToolkitScrollViewCopyConstructorP(void)
292 {
293   ToolkitTestApplication application;
294
295   ScrollView scrollView = ScrollView::New();
296   scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
297
298   ScrollView copy( scrollView );
299   DALI_TEST_CHECK( copy );
300   DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
301   END_TEST;
302 }
303
304 int UtcDaliToolkitScrollViewAssignmentOperatorP(void)
305 {
306   ToolkitTestApplication application;
307
308   ScrollView scrollView = ScrollView::New();
309   scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) );
310
311   ScrollView copy = scrollView;
312   DALI_TEST_CHECK( copy );
313   DALI_TEST_CHECK( copy.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty<Vector2>( ScrollView::Property::SCROLL_POSITION ) );
314   END_TEST;
315 }
316
317 int UtcDaliScrollViewDestructorP(void)
318 {
319   ToolkitTestApplication application;
320
321   ScrollView* scrollView = new ScrollView();
322   delete scrollView;
323
324   DALI_TEST_CHECK( true );
325   END_TEST;
326 }
327
328 int UtcDaliToolkitScrollViewNewP1(void)
329 {
330   ToolkitTestApplication application;
331   tet_infoline(" UtcDaliToolkitScrollViewNewP1");
332
333   ScrollView scrollView;
334
335   DALI_TEST_CHECK( !scrollView );
336
337   scrollView = ScrollView::New();
338
339   DALI_TEST_CHECK( scrollView );
340
341   ScrollView scrollView2(scrollView);
342
343   DALI_TEST_CHECK( scrollView2 == scrollView );
344
345   //Additional check to ensure object is created by checking if it's registered
346   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
347   DALI_TEST_CHECK( registry );
348
349   gObjectCreatedCallBackCalled = false;
350   registry.ObjectCreatedSignal().Connect( &TestCallback );
351   {
352     ScrollView scrollView = ScrollView::New();
353   }
354   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
355   END_TEST;
356 }
357
358 int UtcDaliToolkitScrollViewNewP2(void)
359 {
360   ToolkitTestApplication application;
361   tet_infoline(" UtcDaliToolkitScrollViewNewP2 - create thru type registry");
362
363   ScrollView scrollView;
364   DALI_TEST_CHECK( !scrollView );
365
366   TypeRegistry typeRegistry = TypeRegistry::Get();
367   TypeInfo scrollViewType = typeRegistry.GetTypeInfo("ScrollView");
368   BaseHandle handle = scrollViewType.CreateInstance();
369   DALI_TEST_CHECK( handle );
370
371   scrollView = ScrollView::DownCast(handle);
372   DALI_TEST_CHECK( scrollView );
373
374   END_TEST;
375 }
376
377 int UtcDaliToolkitScrollViewDownCastP(void)
378 {
379   ToolkitTestApplication application;
380   tet_infoline(" UtcDaliToolkitScrollViewDownCastP");
381
382   ScrollView scrollView = ScrollView::New();
383   BaseHandle handle(scrollView);
384
385   ScrollView newScrollView = ScrollView::DownCast( handle );
386   DALI_TEST_CHECK( scrollView );
387   DALI_TEST_CHECK( newScrollView == scrollView );
388   END_TEST;
389 }
390
391 int UtcDaliToolkitScrollViewScrollToPositionP(void)
392 {
393   ToolkitTestApplication application;
394   tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionP");
395
396   // Create the ScrollView actor
397   ScrollView scrollView = ScrollView::New();
398   Stage::GetCurrent().Add( scrollView );
399
400   const Vector2 target = Vector2(100.0f, 200.0f);
401   const Vector2 target2 = Vector2(300.0f, 100.0f);
402
403   scrollView.ScrollTo( target, 0.0f );
404   Wait(application);
405   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
406   scrollView.ScrollTo( target2 );
407   Wait(application, RENDER_DELAY_SCROLL);
408   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
409
410   END_TEST;
411 }
412
413 int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void)
414 {
415   ToolkitTestApplication application;
416   tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP");
417
418   ScrollView scrollView = ScrollView::New();
419   Stage::GetCurrent().Add( scrollView );
420   RulerPtr rulerX = new FixedRuler( 100.0f );
421   rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
422   RulerPtr rulerY = new FixedRuler( 100.0f );
423   rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
424
425   scrollView.SetRulerX( rulerX );
426   scrollView.SetRulerY( rulerY );
427
428   scrollView.SetWrapMode(true);
429
430   Property::Value wrapMode = scrollView.GetProperty( Toolkit::ScrollView::Property::WRAP_ENABLED );
431   DALI_TEST_EQUALS( wrapMode.Get<bool>(), true, TEST_LOCATION );
432
433   const Vector2 target = Vector2(50.0f, 50.0f);
434   const Vector2 target2 = Vector2(150.0f, 150.0f);
435
436   scrollView.ScrollTo( target, 0.0f );
437   Wait(application, RENDER_DELAY_SCROLL);
438   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
439
440   scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
441   Wait(application, RENDER_DELAY_SCROLL);
442   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
443
444   scrollView.ScrollTo( target, 0.0f );
445   Wait(application, RENDER_DELAY_SCROLL);
446   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
447
448   scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
449   Wait(application, RENDER_DELAY_SCROLL);
450   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
451
452   END_TEST;
453 }
454
455 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP(void)
456 {
457   ToolkitTestApplication application;
458   tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP");
459
460   // Create the ScrollView actor
461   ScrollView scrollView = ScrollView::New();
462   Stage::GetCurrent().Add( scrollView );
463
464   const Vector2 target = Vector2(100.0f, 200.0f);
465   const Vector2 target2 = Vector2(300.0f, 100.0f);
466
467   scrollView.ScrollTo( target, 0.5f, TestAlphaFunction );
468   Wait(application, 250);
469   // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
470   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
471
472   scrollView.ScrollTo( target2, 0.5f, AlphaFunction::LINEAR );
473   Wait(application, 250);
474   // Check that the scroll animation has not finished within half of the specified duration with the linear alpha function
475   DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition() != target2 );
476
477   // Wait till the end of the specified duration
478   Wait(application, 250);
479   // Check that the scroll animation has finished
480   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
481
482   END_TEST;
483 }
484
485 int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(void)
486 {
487   ToolkitTestApplication application;
488   tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP");
489
490   ScrollView scrollView = ScrollView::New();
491   Stage::GetCurrent().Add( scrollView );
492   RulerPtr rulerX = new FixedRuler( 100.0f );
493   rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
494   RulerPtr rulerY = new FixedRuler( 100.0f );
495   rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
496
497   scrollView.SetRulerX( rulerX );
498   scrollView.SetRulerY( rulerY );
499
500   scrollView.SetWrapMode(true);
501
502   const Vector2 target = Vector2(50.0f, 50.0f);
503   const Vector2 target2 = Vector2(150.0f, 150.0f);
504
505   scrollView.ScrollTo( target, 0.0f );
506   Wait(application, RENDER_DELAY_SCROLL);
507   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
508
509   scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
510   Wait(application, RENDER_DELAY_SCROLL);
511   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
512
513   scrollView.ScrollTo( target, 0.0f );
514   Wait(application, RENDER_DELAY_SCROLL);
515   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
516
517   scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
518   Wait(application, RENDER_DELAY_SCROLL);
519   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
520
521   scrollView.ScrollTo( target, 0.0f );
522   Wait(application, RENDER_DELAY_SCROLL);
523   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
524
525   scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight );
526   Wait(application, 125);
527   // Check that the scroll animation should finish within just half of the specified duration with the above alpha function
528   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
529
530   END_TEST;
531 }
532
533 int UtcDaliToolkitScrollViewScrollToPageP(void)
534 {
535   ToolkitTestApplication application;
536   tet_infoline(" UtcDaliToolkitScrollViewScrollToPageP");
537
538   ScrollView scrollView = ScrollView::New();
539   Stage::GetCurrent().Add( scrollView );
540   RulerPtr rulerX = new FixedRuler( 100.0f );
541   rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
542   RulerPtr rulerY = new FixedRuler( 100.0f );
543   rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
544
545   scrollView.SetRulerX( rulerX );
546   scrollView.SetRulerY( rulerY );
547
548   scrollView.ScrollTo( 1, 0.0f );
549   Wait(application);
550   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
551
552   scrollView.ScrollTo( 5, 0.0f );
553   Wait(application);
554   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(500.0f, 0.0f), TEST_LOCATION );
555
556   scrollView.ScrollTo( 10, 0.0f );
557   Wait(application);
558   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 100.0f), TEST_LOCATION );
559
560   scrollView.ScrollTo( 15, 0.0f );
561   Wait(application);
562   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(700.0f, 100.0f), TEST_LOCATION );
563   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
564
565   scrollView.ScrollTo( 3 );
566   Wait(application, RENDER_DELAY_SCROLL);
567   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(300.0f, 0.0f), TEST_LOCATION );
568   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
569
570   scrollView.ScrollTo( 9 );
571   Wait(application, RENDER_DELAY_SCROLL);
572   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 100.0f), TEST_LOCATION );
573   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
574
575   // Apply DefaultRulers instead and see what happens.
576   rulerX = new DefaultRuler();
577   rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
578   rulerY = new DefaultRuler();
579   rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
580
581   scrollView.SetRulerX( rulerX );
582   scrollView.SetRulerY( rulerY );
583
584   // This time should always scroll to origin (0.0f, 0.0f)
585   scrollView.ScrollTo( 1, 0.0f );
586   Wait(application);
587   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
588   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
589
590   END_TEST;
591 }
592
593 int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void)
594 {
595   ToolkitTestApplication application;
596   tet_infoline(" UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP");
597
598   ScrollView scrollView = ScrollView::New();
599   Stage::GetCurrent().Add( scrollView );
600   RulerPtr rulerX = new FixedRuler( 100.0f );
601   rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
602   RulerPtr rulerY = new FixedRuler( 100.0f );
603   rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
604
605   scrollView.SetRulerX( rulerX );
606   scrollView.SetRulerY( rulerY );
607
608   scrollView.SetWrapMode(true);
609
610   scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasLeft );
611
612   Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
613   // Check that the scroll position remains the same
614   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
615
616   Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
617   // Check that it stays at the same page (i.e. the same scroll position)
618   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
619   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
620
621   scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasRight );
622
623   Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame
624   // Check that it scrolls towards the right
625   DALI_TEST_CHECK( scrollView.GetCurrentScrollPosition().x > 0.0f );
626
627   Wait(application, RENDER_DELAY_SCROLL); // Wait for one second
628   // Check that it scrolls back to the same page (i.e. the same scroll position)
629   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
630   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION );
631
632   END_TEST;
633 }
634
635 int UtcDaliToolkitScrollViewScrollToActorP(void)
636 {
637   ToolkitTestApplication application;
638   tet_infoline(" UtcDaliToolkitScrollViewScrollToActorP");
639
640   ScrollView scrollView = ScrollView::New();
641   Stage::GetCurrent().Add( scrollView );
642
643   Actor actorA = Actor::New();
644   const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f);
645   actorA.SetPosition(positionA);
646   scrollView.Add(actorA);
647
648   Actor actorB = Actor::New();
649   const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f);
650   actorB.SetPosition(positionB);
651   scrollView.Add(actorB);
652
653   Wait(application);
654
655   scrollView.ScrollTo(actorA, 0.0f);
656   Wait(application);
657   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
658
659   Wait(application);
660   scrollView.ScrollTo(actorB, 0.0f);
661   Wait(application);
662   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
663
664   scrollView.ScrollTo(actorA);
665   Wait(application, RENDER_DELAY_SCROLL);
666   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA.GetVectorXY(), TEST_LOCATION );
667
668   scrollView.ScrollTo(actorB);
669   Wait(application, RENDER_DELAY_SCROLL);
670   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB.GetVectorXY(), TEST_LOCATION );
671   END_TEST;
672 }
673
674 int UtcDaliToolkitScrollViewScrollToSnapPointP(void)
675 {
676   ToolkitTestApplication application;
677   tet_infoline(" UtcDaliToolkitScrollViewScrollToSnapPointP");
678
679   ScrollView scrollView = ScrollView::New();
680   Stage::GetCurrent().Add( scrollView );
681   RulerPtr rulerX = new FixedRuler( 100.0f );
682   rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
683   RulerPtr rulerY = new FixedRuler( 100.0f );
684   rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
685
686   scrollView.SetRulerX( rulerX );
687   scrollView.SetRulerY( rulerY );
688
689   scrollView.ScrollTo( Vector2(120.0f, 190.0f), 0.0f );
690   Wait(application);
691   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(120.0f, 190.0f), TEST_LOCATION );
692
693   scrollView.ScrollToSnapPoint();
694
695   Wait(application, RENDER_DELAY_SCROLL);
696   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 200.0f), TEST_LOCATION );
697   END_TEST;
698 }
699
700 int UtcDaliToolkitScrollViewSetScrollUpdateDistanceP(void)
701 {
702   ToolkitTestApplication application;
703   tet_infoline(" UtcDaliToolkitScrollViewSetScrollUpdateDistanceP");
704
705   ScrollView scrollView = ScrollView::New();
706
707   scrollView.SetScrollUpdateDistance(0);
708   DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 0, TEST_LOCATION);
709   scrollView.SetScrollUpdateDistance(10);
710   DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 10, TEST_LOCATION);
711   scrollView.SetScrollUpdateDistance(1000);
712   DALI_TEST_EQUALS( scrollView.GetScrollUpdateDistance(), 1000, TEST_LOCATION);
713   END_TEST;
714 }
715
716 int UtcDaliToolkitScrollViewSetWrapModeP(void)
717 {
718   ToolkitTestApplication application;
719   tet_infoline(" UtcDaliToolkitScrollViewSetWrapModeP");
720
721   ScrollView scrollView = ScrollView::New();
722   Stage::GetCurrent().Add( scrollView );
723
724   Actor actor = Actor::New();
725   scrollView.Add( actor );
726
727   // Position rulers. 4x4 grid.
728   RulerPtr rulerX = new FixedRuler(50.0f);
729   RulerPtr rulerY = new FixedRuler(50.0f);
730   rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) );
731   rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) );
732   scrollView.SetRulerX(rulerX);
733   scrollView.SetRulerY(rulerY);
734
735   scrollView.SetWrapMode(false);
736   scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
737   Wait(application);
738   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
739
740   scrollView.SetWrapMode(true);
741   scrollView.ScrollTo(Vector2(230.0f, 130.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
742   Wait(application);
743   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 13, TEST_LOCATION );
744   END_TEST;
745 }
746
747 int UtcDaliToolkitScrollViewActorAutoSnap(void)
748 {
749   ToolkitTestApplication application;
750   tet_infoline(" UtcDaliToolkitScrollViewActorAutoSnap");
751
752   ScrollView scrollView = ScrollView::New();
753   Stage::GetCurrent().Add( scrollView );
754
755   // Position rulers.
756   RulerPtr rulerX = new DefaultRuler();
757   RulerPtr rulerY = new DefaultRuler();
758   rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
759   rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
760   scrollView.SetRulerX(rulerX);
761   scrollView.SetRulerY(rulerY);
762
763   const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f);
764   Actor a = Actor::New();
765   scrollView.Add(a);
766   a.SetPosition(aPosition);
767
768   const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f);
769   Actor b = Actor::New();
770   scrollView.Add(b);
771   b.SetPosition(bPosition);
772
773   // Goto a random position, and execute snap (should not move)
774   Vector2 targetScroll = Vector2(500.0f, 500.0f);
775   scrollView.ScrollTo(targetScroll, 0.0f);
776   Wait(application);
777   scrollView.ScrollToSnapPoint();
778   Wait(application, RENDER_DELAY_SCROLL);
779   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION );
780
781   // Enable ActorAutoSnap, and now try snapping.
782   scrollView.SetActorAutoSnap(true);
783   scrollView.ScrollToSnapPoint();
784   Wait(application, RENDER_DELAY_SCROLL);
785   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition.GetVectorXY(), TEST_LOCATION );
786
787   scrollView.ScrollTo(Vector2(0.0f, 0.0f), 0.0f);
788   Wait(application);
789   scrollView.ScrollToSnapPoint();
790   Wait(application, RENDER_DELAY_SCROLL);
791   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition.GetVectorXY(), TEST_LOCATION );
792   END_TEST;
793 }
794
795 int UtcDaliToolkitScrollViewSignalsStartComplete(void)
796 {
797   ToolkitTestApplication application;
798   tet_infoline(" UtcDaliToolkitScrollViewSignalsStartComplete");
799
800   gOnScrollStartCalled = false;
801   gOnScrollCompleteCalled = false;
802
803   ScrollView scrollView = ScrollView::New();
804   Stage::GetCurrent().Add( scrollView );
805
806   // Position rulers.
807   RulerPtr rulerX = new DefaultRuler();
808   RulerPtr rulerY = new DefaultRuler();
809   rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
810   rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
811   scrollView.SetRulerX(rulerX);
812   scrollView.SetRulerY(rulerY);
813   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
814   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
815   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
816   scrollView.ScrollTo( Vector2(100.0f, 100.0f) );
817   Wait(application, RENDER_DELAY_SCROLL);
818
819   DALI_TEST_CHECK(gOnScrollStartCalled);
820   DALI_TEST_CHECK(gOnScrollCompleteCalled);
821   END_TEST;
822 }
823
824 int UtcDaliToolkitScrollViewSignalsUpdate01(void)
825 {
826   ToolkitTestApplication application;
827   tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
828
829   gOnScrollStartCalled = false;
830   gOnScrollUpdateCalled = false;
831   gOnScrollCompleteCalled = false;
832
833   ScrollView scrollView = ScrollView::New();
834   Stage::GetCurrent().Add( scrollView );
835   Vector2 stageSize = Stage::GetCurrent().GetSize();
836   scrollView.SetSize(stageSize);
837   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
838   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
839
840   // Position rulers.
841   RulerPtr rulerX = new DefaultRuler();
842   RulerPtr rulerY = new DefaultRuler();
843   rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
844   rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
845   scrollView.SetRulerX(rulerX);
846   scrollView.SetRulerY(rulerY);
847   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
848   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
849   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
850
851   Actor image = Actor::New();
852   image.SetSize(stageSize);
853   image.SetParentOrigin(ParentOrigin::TOP_LEFT);
854   image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
855   scrollView.Add(image);
856
857   Wait(application);
858
859   // Do a pan starting from 100,100 and moving down diagonally.
860   Vector2 pos(100.0f, 100.0f);
861   SendPan(application, Gesture::Possible, pos);
862   SendPan(application, Gesture::Started, pos);
863   pos.x += 5.0f;
864   pos.y += 5.0f;
865   Wait(application, 100);
866
867   for(int i = 0;i<20;i++)
868   {
869     SendPan(application, Gesture::Continuing, pos);
870     pos.x += 5.0f;
871     pos.y += 5.0f;
872     Wait(application);
873   }
874
875   SendPan(application, Gesture::Finished, pos);
876   Wait(application, RENDER_DELAY_SCROLL);
877
878   DALI_TEST_CHECK(gOnScrollStartCalled);
879   DALI_TEST_CHECK(gOnScrollUpdateCalled);
880   DALI_TEST_CHECK(gOnScrollCompleteCalled);
881   END_TEST;
882 }
883
884 int UtcDaliToolkitScrollViewSignalsUpdate02(void)
885 {
886   ToolkitTestApplication application;
887   tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
888
889   gOnScrollStartCalled = false;
890   gOnScrollUpdateCalled = false;
891   gOnScrollCompleteCalled = false;
892
893   ScrollView scrollView = ScrollView::New();
894   Stage::GetCurrent().Add( scrollView );
895   Vector2 stageSize = Stage::GetCurrent().GetSize();
896   scrollView.SetSize(stageSize);
897   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
898   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
899
900   // Position rulers.
901   RulerPtr rulerX = new DefaultRuler();
902   RulerPtr rulerY = new DefaultRuler();
903   rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
904   rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
905   scrollView.SetRulerX(rulerX);
906   scrollView.SetRulerY(rulerY);
907   Dali::ConnectionTracker tracker;
908   bool scrollStarted=false;
909   bool scrollUpdated=false;
910   bool scrollCompleted=false;
911   DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) ));
912   DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) ));
913   DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) ));
914
915   Actor image = Actor::New();
916   image.SetSize(stageSize);
917   image.SetParentOrigin(ParentOrigin::TOP_LEFT);
918   image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
919   scrollView.Add(image);
920
921   Wait(application);
922
923   // Do a pan starting from 100,100 and moving down diagonally.
924   Vector2 pos(100.0f, 100.0f);
925   SendPan(application, Gesture::Possible, pos);
926   SendPan(application, Gesture::Started, pos);
927   pos.x += 5.0f;
928   pos.y += 5.0f;
929   Wait(application, 100);
930
931   for(int i = 0;i<20;i++)
932   {
933     SendPan(application, Gesture::Continuing, pos);
934     pos.x += 5.0f;
935     pos.y += 5.0f;
936     Wait(application);
937   }
938
939   SendPan(application, Gesture::Finished, pos);
940   Wait(application, RENDER_DELAY_SCROLL);
941
942   DALI_TEST_CHECK(scrollStarted);
943   DALI_TEST_CHECK(scrollUpdated);
944   DALI_TEST_CHECK(scrollCompleted);
945
946   Stage::GetCurrent().Remove( scrollView );
947
948   END_TEST;
949 }
950
951 static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
952 {
953   gOnScrollStartCalled = false;
954   gOnScrollUpdateCalled = false;
955   gOnScrollCompleteCalled = false;
956   gOnSnapStartCalled = false;
957
958   // Now do a pan starting from (start) and heading (direction)
959   Vector2 pos(start);
960   SendPan(application, Gesture::Possible, pos);
961   SendPan(application, Gesture::Started, pos);
962   Wait(application);
963
964   for(int i = 0;i<frames;i++)
965   {
966     pos += direction; // Move in this direction
967     SendPan(application, Gesture::Continuing, pos);
968     Wait(application);
969   }
970
971   if(finish)
972   {
973     pos += direction; // Move in this direction.
974     SendPan(application, Gesture::Finished, pos);
975     Wait(application, RENDER_DELAY_SCROLL);
976   }
977
978   return pos;
979 }
980
981 int UtcDaliToolkitScrollViewScrollSensitive(void)
982 {
983   ToolkitTestApplication application;
984   tet_infoline(" UtcDaliToolkitScrollViewScrollSensitive");
985
986   // Set up a scrollView...
987   ScrollView scrollView = ScrollView::New();
988   scrollView.SetOvershootEnabled(true);
989   Stage::GetCurrent().Add( scrollView );
990   Vector2 stageSize = Stage::GetCurrent().GetSize();
991   scrollView.SetSize(stageSize);
992   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
993   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
994
995   // Position rulers.
996   RulerPtr rulerX = new DefaultRuler();
997   RulerPtr rulerY = new DefaultRuler();
998   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
999   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1000   scrollView.SetRulerX(rulerX);
1001   scrollView.SetRulerY(rulerY);
1002   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1003   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1004   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1005   scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1006
1007   scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1008   Wait(application);
1009
1010   // First try insensitive swipe.
1011   scrollView.SetScrollSensitive(false);
1012   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1013
1014   DALI_TEST_CHECK( !gOnScrollStartCalled );
1015   DALI_TEST_CHECK( !gOnScrollCompleteCalled );
1016   DALI_TEST_CHECK( !gOnSnapStartCalled );
1017
1018   // Second try sensitive swipe.
1019   scrollView.SetScrollSensitive(true);
1020   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
1021
1022   DALI_TEST_CHECK( gOnScrollStartCalled );
1023   DALI_TEST_CHECK( gOnScrollCompleteCalled );
1024   DALI_TEST_CHECK( gOnSnapStartCalled );
1025   END_TEST;
1026 }
1027
1028 int UtcDaliToolkitScrollViewAxisAutoLock(void)
1029 {
1030   ToolkitTestApplication application;
1031   tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLock");
1032
1033   // Set up a scrollView...
1034   ScrollView scrollView = ScrollView::New();
1035   Stage::GetCurrent().Add( scrollView );
1036   Vector2 stageSize = Stage::GetCurrent().GetSize();
1037   scrollView.SetSize(stageSize);
1038   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1039   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1040
1041   // Position rulers.
1042   RulerPtr rulerX = new DefaultRuler();
1043   RulerPtr rulerY = new DefaultRuler();
1044   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1045   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1046   scrollView.SetRulerX(rulerX);
1047   scrollView.SetRulerY(rulerY);
1048   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1049   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1050   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1051
1052   // Normal
1053   scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1054   Wait(application);
1055   Vector2 startPosition = scrollView.GetCurrentScrollPosition();
1056   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1057   const Vector2 positionAfterNormal = scrollView.GetCurrentScrollPosition();
1058
1059   // Autolock
1060   scrollView.SetAxisAutoLock(true);
1061   DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
1062
1063   scrollView.ScrollTo(Vector2(100.0f, 100.0f), 0.0f); // move in a little.
1064   Wait(application);
1065   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
1066   const Vector2 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
1067
1068   // compare how much the Y position has deviated for normal and autolock.
1069   const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
1070   const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
1071
1072   // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
1073   DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
1074
1075   scrollView.SetAxisAutoLock(false);
1076   DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
1077   END_TEST;
1078 }
1079
1080 int UtcDaliToolkitScrollViewAxisAutoLockGradient(void)
1081 {
1082   ToolkitTestApplication application;
1083   tet_infoline(" UtcDaliToolkitScrollViewAxisAutoLockGradient");
1084
1085   // Set up a scrollView...
1086   ScrollView scrollView = ScrollView::New();
1087   scrollView.SetAxisAutoLockGradient(0.5f);
1088   DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
1089   scrollView.SetAxisAutoLockGradient(1.0f);
1090   DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
1091   END_TEST;
1092 }
1093
1094 int UtcDaliToolkitScrollViewConstraints(void)
1095 {
1096   ToolkitTestApplication application;
1097   tet_infoline(" UtcDaliToolkitScrollViewConstraints");
1098
1099   // Set up a scrollView...
1100   ScrollView scrollView = ScrollView::New();
1101   Stage::GetCurrent().Add( scrollView );
1102   Vector2 stageSize = Stage::GetCurrent().GetSize();
1103   scrollView.SetSize(stageSize);
1104   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1105   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1106
1107   // Position rulers.
1108   RulerPtr rulerX = new DefaultRuler();
1109   RulerPtr rulerY = new DefaultRuler();
1110   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1111   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1112   scrollView.SetRulerX(rulerX);
1113   scrollView.SetRulerY(rulerY);
1114
1115   // Add an Actor to ScrollView,
1116   // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1117   gConstraintResult = Vector3::ZERO;
1118   Actor a = Actor::New();
1119   scrollView.Add(a);
1120   a.SetPosition( TEST_ACTOR_POSITION );
1121   Wait(application);
1122
1123   Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1124   constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1125   constraint.SetRemoveAction(Constraint::Discard);
1126   scrollView.ApplyConstraintToChildren(constraint);
1127   Wait(application);
1128
1129   DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1130
1131   gConstraintResult = Vector3::ZERO;
1132   scrollView.RemoveConstraintsFromChildren();
1133   Wait(application);
1134
1135   DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1136   END_TEST;
1137 }
1138
1139 int UtcDaliToolkitScrollViewBind(void)
1140 {
1141   ToolkitTestApplication application;
1142   tet_infoline(" UtcDaliToolkitScrollViewBind");
1143
1144   // Set up a scrollView...
1145   ScrollView scrollView = ScrollView::New();
1146   Stage::GetCurrent().Add( scrollView );
1147   Vector2 stageSize = Stage::GetCurrent().GetSize();
1148   scrollView.SetSize(stageSize);
1149   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1150   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1151
1152   // Position rulers.
1153   RulerPtr rulerX = new DefaultRuler();
1154   RulerPtr rulerY = new DefaultRuler();
1155   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1156   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1157   scrollView.SetRulerX(rulerX);
1158   scrollView.SetRulerY(rulerY);
1159
1160   // Add an Actor to ScrollView,
1161   // Apply TestSumConstraint to ScrollView's children (includes this Actor)
1162
1163   gConstraintResult = Vector3::ZERO;
1164   Actor a = Actor::New();
1165   scrollView.Add(a);
1166   a.SetPosition( TEST_ACTOR_POSITION );
1167   Wait(application);
1168
1169   // apply this constraint to scrollview
1170   Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
1171   constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
1172   constraint.SetRemoveAction(Constraint::Discard);
1173   scrollView.ApplyConstraintToChildren(constraint);
1174
1175   Wait(application);
1176   // Defaulty Bound.
1177   DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1178
1179   // UnBind
1180   gConstraintResult = Vector3::ZERO;
1181   scrollView.UnbindActor( a );
1182   Wait(application);
1183   DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
1184
1185   // Bind
1186   gConstraintResult = Vector3::ZERO;
1187   scrollView.BindActor( a );
1188   Wait(application);
1189   DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
1190   END_TEST;
1191 }
1192
1193 int UtcDaliToolkitScrollViewOvershoot(void)
1194 {
1195   ToolkitTestApplication application;
1196   tet_infoline(" UtcDaliToolkitScrollViewOvershoot");
1197
1198   // Set up a scrollView...
1199   ScrollView scrollView = ScrollView::New();
1200   scrollView.SetOvershootEnabled(true);
1201
1202   Vector2 overshootSize = Vector2(100.0f,100.0f);
1203   scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
1204   DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
1205
1206   Stage::GetCurrent().Add( scrollView );
1207   Vector2 stageSize = Stage::GetCurrent().GetSize();
1208   scrollView.SetSize(stageSize);
1209   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1210   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1211
1212   // Position rulers.
1213   RulerPtr rulerX = new DefaultRuler();
1214   RulerPtr rulerY = new DefaultRuler();
1215   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1216   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1217   scrollView.SetRulerX(rulerX);
1218   scrollView.SetRulerY(rulerY);
1219   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
1220   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1221   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
1222
1223   scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1224   Wait(application);
1225
1226   // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
1227   Vector2 currentPos = Vector2(100.0f, 100.0f);
1228   currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
1229   float overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1230   float overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1231   Vector2 positionValue = scrollView.GetProperty<Vector2>(ScrollView::Property::SCROLL_POSITION);
1232   DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1233   DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1234   DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION);
1235
1236   float timeToReachOrigin;
1237
1238   // Now release touch. Overshoot should snap back to zero.
1239   SendPan(application, Gesture::Finished, currentPos);
1240   timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1241
1242   float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1243   float maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1244
1245   DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1246                    (timeToReachOrigin < maxTimeToReachOrigin) );
1247
1248   // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
1249   scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
1250
1251   currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1252   // Now release touch. Overshoot should snap back to zero.
1253   SendPan(application, Gesture::Finished, currentPos);
1254   timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1255
1256   minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1257   maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1258
1259   DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1260                    (timeToReachOrigin < maxTimeToReachOrigin) );
1261
1262   // 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
1263   scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
1264
1265   currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1266   // Now release touch. Overshoot should snap back to zero.
1267   SendPan(application, Gesture::Finished, currentPos);
1268   timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1269
1270   minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1271   maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1272
1273   DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1274                    (timeToReachOrigin < maxTimeToReachOrigin) );
1275
1276   // 4. Repeat Scroll, but this time change overshoot function.
1277   scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION);
1278   scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
1279
1280   currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
1281   // Now release touch. Overshoot should snap back to zero.
1282   SendPan(application, Gesture::Finished, currentPos);
1283   timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
1284
1285   minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE;
1286   maxTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) + TIME_TOLERANCE;
1287
1288   DALI_TEST_CHECK( (timeToReachOrigin > minTimeToReachOrigin) &&
1289                    (timeToReachOrigin < maxTimeToReachOrigin) );
1290   END_TEST;
1291 }
1292
1293 int UtcDaliToolkitScrollViewSnapAlphaFunction(void)
1294 {
1295   ToolkitTestApplication application;
1296   tet_infoline(" UtcDaliToolkitScrollViewSnapAlphaFunction");
1297
1298   // Set up a scrollView...
1299   ScrollView scrollView = ScrollView::New();
1300   scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_IN );
1301   DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_IN );
1302   scrollView.SetScrollSnapAlphaFunction( AlphaFunction::EASE_OUT );
1303   DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction().GetBuiltinFunction() == AlphaFunction::EASE_OUT );
1304
1305   scrollView.SetScrollFlickAlphaFunction( AlphaFunction::BOUNCE );
1306   DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction().GetBuiltinFunction() == AlphaFunction::BOUNCE );
1307
1308   END_TEST;
1309 }
1310
1311 int UtcDaliToolkitScrollViewSnapDuration(void)
1312 {
1313   ToolkitTestApplication application;
1314   tet_infoline(" UtcDaliToolkitScrollViewSnapDuration");
1315
1316   // Set up a scrollView...
1317   ScrollView scrollView = ScrollView::New();
1318   scrollView.SetScrollSnapDuration( 1.0f );
1319   DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION );
1320   scrollView.SetScrollSnapDuration( 0.5f );
1321   DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION );
1322
1323   scrollView.SetScrollFlickDuration( 2.0f );
1324   DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION );
1325   scrollView.SetScrollFlickDuration( 1.5f );
1326   DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION );
1327   END_TEST;
1328 }
1329
1330 int UtcDaliToolkitScrollViewSnapStartedSignalP(void)
1331 {
1332   ToolkitTestApplication application;
1333   tet_infoline(" UtcDaliToolkitScrollViewSnapStartedSignalP");
1334
1335   // Set up a scrollView...
1336   ScrollView scrollView = ScrollView::New();
1337   Stage::GetCurrent().Add( scrollView );
1338   Vector2 stageSize = Stage::GetCurrent().GetSize();
1339   scrollView.SetSize(stageSize);
1340   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1341   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1342
1343   // Position rulers.
1344   RulerPtr rulerX = new DefaultRuler();
1345   RulerPtr rulerY = new DefaultRuler();
1346   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1347   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1348   scrollView.SetRulerX(rulerX);
1349   scrollView.SetRulerY(rulerY);
1350   scrollView.SnapStartedSignal().Connect( &OnSnapStart );
1351
1352   scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
1353   Wait(application);
1354
1355   // First try a snap.
1356   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true);
1357
1358   DALI_TEST_CHECK( gOnSnapStartCalled );
1359   DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
1360
1361   // Second try a swipe.
1362   PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true);
1363
1364   DALI_TEST_CHECK( gOnSnapStartCalled );
1365   DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
1366   END_TEST;
1367 }
1368
1369 int UtcDaliToolkitScrollViewGetCurrentPageP(void)
1370 {
1371   ToolkitTestApplication application;
1372   tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP");
1373
1374   ScrollView scrollView = ScrollView::New();
1375   Stage::GetCurrent().Add( scrollView );
1376   RulerPtr rulerX = new FixedRuler( 100.0f );
1377   rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1378   RulerPtr rulerY = new FixedRuler( 100.0f );
1379   rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1380
1381   scrollView.SetRulerX( rulerX );
1382   scrollView.SetRulerY( rulerY );
1383
1384   scrollView.ScrollTo( 15 );
1385   Wait(application, RENDER_DELAY_SCROLL);
1386   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 15, TEST_LOCATION );
1387
1388   scrollView.ScrollTo( 3 );
1389   Wait(application, RENDER_DELAY_SCROLL);
1390   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 3, TEST_LOCATION );
1391
1392   scrollView.ScrollTo( 9 );
1393   Wait(application, RENDER_DELAY_SCROLL);
1394   DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 9, TEST_LOCATION );
1395
1396   END_TEST;
1397 }
1398
1399 int UtcDaliToolkitScrollViewSetMaxOvershootP(void)
1400 {
1401   ToolkitTestApplication application;
1402   tet_infoline(" UtcDaliToolkitScrollViewSetMaxOvershootP");
1403
1404   // Set up a scrollView...
1405   ScrollView scrollView = ScrollView::New();
1406   Stage::GetCurrent().Add( scrollView );
1407   Vector2 stageSize = Stage::GetCurrent().GetSize();
1408   scrollView.SetSize(stageSize);
1409   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1410   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1411
1412   // Position rulers.
1413   RulerPtr rulerX = new DefaultRuler();
1414   RulerPtr rulerY = new DefaultRuler();
1415   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
1416   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
1417   scrollView.SetRulerX(rulerX);
1418   scrollView.SetRulerY(rulerY);
1419
1420   // Set the max overshoot to be 50 pixels in both X axis and Y axis
1421   scrollView.SetMaxOvershoot(50.0f, 50.0f);
1422
1423   scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
1424   Wait(application);
1425
1426   // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch)
1427   Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false);
1428   float overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1429   float overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1430   DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION);
1431   DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION);
1432
1433   // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch)
1434   currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false);
1435   overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1436   overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1437   // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot.
1438   // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105.
1439   float correctOvershootValue = 50.0f / 105.f;
1440   DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1441   DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION );
1442
1443   // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1444   currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1445   overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1446   overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1447   DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1448   DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1449
1450   // Change the max overshoot to be 100 pixels in both X axis and Y axis
1451   scrollView.SetMaxOvershoot(100.0f, 100.0f);
1452   Wait(application);
1453
1454   // Check that overshoot should be now around 0.8.
1455   overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1456   overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1457   DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f);
1458   DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f);
1459
1460   // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch)
1461   currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false);
1462   overshootXValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_X);
1463   overshootYValue = scrollView.GetProperty<float>(ScrollView::Property::OVERSHOOT_Y);
1464   DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION);
1465   DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION);
1466
1467   END_TEST;
1468 }
1469
1470 int UtcDaliToolkitScrollViewSetScrollingDirectionP(void)
1471 {
1472   ToolkitTestApplication application;
1473   tet_infoline(" UtcDaliToolkitScrollViewSetScrollingDirectionP");
1474
1475   // Set up a scrollView...
1476   ScrollView scrollView = ScrollView::New();
1477   Stage::GetCurrent().Add( scrollView );
1478   Vector2 stageSize = Stage::GetCurrent().GetSize();
1479   scrollView.SetSize(stageSize);
1480   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1481   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1482
1483   Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1484
1485   scrollView.ScrollTo(START_POSITION, 0.0f);
1486   Wait(application);
1487   // Try a vertical swipe.
1488   PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1489   // Take into account resampling done when prediction is off.
1490   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1491
1492   scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1493
1494   scrollView.ScrollTo(START_POSITION, 0.0f);
1495   Wait(application);
1496   // Try a vertical swipe.
1497   PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1498   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1499
1500   scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1501
1502   scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1503   Wait(application);
1504   // Try a vertical swipe.
1505   PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1506   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1507
1508   END_TEST;
1509 }
1510
1511 int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void)
1512 {
1513   ToolkitTestApplication application;
1514   tet_infoline(" UtcDaliToolkitScrollViewRemoveScrollingDirectionP");
1515
1516   // Set up a scrollView...
1517   ScrollView scrollView = ScrollView::New();
1518   Stage::GetCurrent().Add( scrollView );
1519   Vector2 stageSize = Stage::GetCurrent().GetSize();
1520   scrollView.SetSize(stageSize);
1521   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
1522   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1523
1524   Vector2 START_POSITION = Vector2(10.0f, 10.0f);
1525
1526   scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1527
1528   scrollView.ScrollTo(START_POSITION, 0.0f);
1529   Wait(application);
1530   // Try a vertical swipe.
1531   PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1532   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION );
1533
1534   scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL);
1535
1536   scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f);
1537   Wait(application);
1538   // Try a vertical swipe.
1539   PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true);
1540   // Take into account resampling done when prediction is off.
1541   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION );
1542
1543   END_TEST;
1544 }
1545
1546 int UtcDaliToolkitScrollViewSetRulerXP(void)
1547 {
1548   ToolkitTestApplication application;
1549   tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP");
1550
1551   ScrollView scrollView = ScrollView::New();
1552   Stage::GetCurrent().Add( scrollView );
1553   RulerPtr rulerX = new FixedRuler( 100.0f );
1554   rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1555
1556   scrollView.SetRulerX( rulerX );
1557
1558   scrollView.ScrollTo( 1, 0.0f );
1559   Wait(application);
1560   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(100.0f, 0.0f), TEST_LOCATION );
1561
1562   RulerPtr newRulerX = new FixedRuler( 200.0f );
1563   newRulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
1564
1565   scrollView.SetRulerX( newRulerX );
1566
1567   scrollView.ScrollTo( 1, 0.0f );
1568   Wait(application);
1569   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(200.0f, 0.0f), TEST_LOCATION );
1570
1571   END_TEST;
1572 }
1573
1574 int UtcDaliToolkitScrollViewSetRulerYP(void)
1575 {
1576   ToolkitTestApplication application;
1577   tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP");
1578
1579   ScrollView scrollView = ScrollView::New();
1580   Stage::GetCurrent().Add( scrollView );
1581
1582   RulerPtr rulerY = new FixedRuler( 200.0f );
1583   rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
1584
1585   scrollView.SetRulerY( rulerY );
1586
1587   scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1588   Wait(application);
1589   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 350.0f), TEST_LOCATION );
1590
1591   RulerPtr newRulerY = new FixedRuler( 100.0f );
1592   newRulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
1593   scrollView.SetRulerY( newRulerY );
1594
1595   scrollView.ScrollTo( Vector2(0.0f, 350.0f), 0.0f );
1596   Wait(application);
1597   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 200.0f), TEST_LOCATION );
1598
1599   END_TEST;
1600 }
1601
1602 int UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP(void)
1603 {
1604   ToolkitTestApplication application;
1605   tet_infoline(" UtcDaliToolkitScrollViewSetMinimumSpeedForFlickP");
1606
1607   ScrollView scrollView = ScrollView::New();
1608   scrollView.SetMinimumSpeedForFlick(25.0f);
1609   DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 25.0f, TEST_LOCATION );
1610   scrollView.SetMinimumSpeedForFlick(60.0f);
1611   DALI_TEST_EQUALS( scrollView.GetMinimumSpeedForFlick(), 60.0f, TEST_LOCATION );
1612   END_TEST;
1613 }
1614
1615 int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void)
1616 {
1617   ToolkitTestApplication application;
1618   tet_infoline(" UtcDaliToolkitScrollViewSetMinimumDistanceForFlick");
1619
1620   ScrollView scrollView = ScrollView::New();
1621
1622   scrollView.SetMinimumDistanceForFlick(Vector2(30.0f, 15.0f));
1623   DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1624   scrollView.SetMinimumDistanceForFlick(Vector2(60.0f, 30.0f));
1625   DALI_TEST_EQUALS( scrollView.GetMinimumDistanceForFlick(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1626   END_TEST;
1627 }
1628
1629 int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void)
1630 {
1631   ToolkitTestApplication application;
1632   tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP");
1633
1634   ScrollView scrollView = ScrollView::New();
1635   // Disable Refresh signal (TET environment cannot use adaptor's Timer)
1636   scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
1637   DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION );
1638   scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
1639   DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
1640   END_TEST;
1641 }
1642
1643 int UtcDaliToolkitScrollViewApplyEffectP(void)
1644 {
1645   ToolkitTestApplication application;
1646   tet_infoline(" UtcDaliToolkitScrollViewApplyEffectP");
1647
1648   // Create a ScrollView
1649   ScrollView scrollView = ScrollView::New();
1650
1651   // Create two scroll view effects
1652   Dali::Path path = Dali::Path::New();
1653   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);
1654   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);
1655
1656   // Apply both effects
1657   scrollView.ApplyEffect(effect);
1658   scrollView.ApplyEffect(newEffect);
1659
1660   DALI_TEST_CHECK( true );
1661
1662   END_TEST;
1663 }
1664
1665 int UtcDaliToolkitScrollViewApplyEffectN(void)
1666 {
1667   ToolkitTestApplication application;
1668   tet_infoline(" UtcDaliToolkitScrollViewApplyEffectN");
1669
1670   // Create a ScrollView
1671   ScrollView scrollView = ScrollView::New();
1672
1673   // Create two scroll view effects
1674   Dali::Path path = Dali::Path::New();
1675   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);
1676   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);
1677
1678   // Apply both effects
1679   scrollView.ApplyEffect(effect);
1680   scrollView.ApplyEffect(newEffect);
1681
1682   // Attempt to apply the same effect again
1683   try
1684   {
1685     scrollView.ApplyEffect(newEffect);
1686     tet_result( TET_FAIL );
1687   }
1688   catch ( DaliException& e )
1689   {
1690     DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1691   }
1692
1693   END_TEST;
1694 }
1695
1696 int UtcDaliToolkitScrollViewRemoveEffectP(void)
1697 {
1698   ToolkitTestApplication application;
1699   tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectP");
1700
1701   // Create a ScrollView
1702   ScrollView scrollView = ScrollView::New();
1703
1704   // Create two scroll view effects
1705   Dali::Path path = Dali::Path::New();
1706   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);
1707   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);
1708
1709   // Apply both effects
1710   scrollView.ApplyEffect(effect);
1711   scrollView.ApplyEffect(newEffect);
1712
1713   // Remove both effects
1714   scrollView.RemoveEffect(effect);
1715   scrollView.RemoveEffect(newEffect);
1716
1717   DALI_TEST_CHECK( true );
1718
1719   END_TEST;
1720 }
1721
1722 int UtcDaliToolkitScrollViewRemoveEffectN(void)
1723 {
1724   ToolkitTestApplication application;
1725   tet_infoline(" UtcDaliToolkitScrollViewRemoveEffectN");
1726
1727   // Create a ScrollView
1728   ScrollView scrollView = ScrollView::New();
1729
1730   // Create two scroll view effects
1731   Dali::Path path = Dali::Path::New();
1732   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);
1733   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);
1734
1735   // Apply the first effect
1736   scrollView.ApplyEffect(effect);
1737
1738   // Attempt to remove the second effect which has not been applied to scroll view
1739   try
1740   {
1741     scrollView.RemoveEffect(newEffect);
1742     tet_result( TET_FAIL );
1743   }
1744   catch ( DaliException& e )
1745   {
1746     DALI_TEST_ASSERT( e, "effectExistedInScrollView", TEST_LOCATION );
1747   }
1748
1749   END_TEST;
1750 }
1751
1752 int UtcDaliToolkitScrollViewRemoveAllEffectsP(void)
1753 {
1754   ToolkitTestApplication application;
1755   tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsP");
1756
1757   // Create a ScrollView
1758   ScrollView scrollView = ScrollView::New();
1759
1760   // Create two scroll view effects
1761   Dali::Path path = Dali::Path::New();
1762   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);
1763   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);
1764
1765   // Apply both effects
1766   scrollView.ApplyEffect(effect);
1767   scrollView.ApplyEffect(newEffect);
1768
1769   // Attempt to apply the same first effect again
1770   try
1771   {
1772     scrollView.ApplyEffect(effect);
1773     tet_result( TET_FAIL );
1774   }
1775   catch ( DaliException& e )
1776   {
1777     DALI_TEST_ASSERT( e, "!effectAlreadyExistsInScrollView", TEST_LOCATION );
1778   }
1779
1780   // Remove both effects
1781   scrollView.RemoveAllEffects();
1782
1783   // Apply both effects again
1784   scrollView.ApplyEffect(effect);
1785   scrollView.ApplyEffect(newEffect);
1786
1787   DALI_TEST_CHECK( true );
1788
1789   END_TEST;
1790 }
1791
1792 int UtcDaliToolkitScrollViewRemoveAllEffectsN(void)
1793 {
1794   ToolkitTestApplication application;
1795   tet_infoline(" UtcDaliToolkitScrollViewRemoveAllEffectsN");
1796
1797   // Create a ScrollView
1798   ScrollView scrollView = ScrollView::New();
1799
1800   // Remove effects when there is no effect applied previously
1801   scrollView.RemoveAllEffects();
1802
1803   DALI_TEST_CHECK( true );
1804
1805   END_TEST;
1806 }
1807
1808 int UtcDaliToolkitScrollViewSetOvershootEnabledP(void)
1809 {
1810   ToolkitTestApplication application;
1811   tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEnabledP");
1812
1813   ScrollView scrollView = ScrollView::New();
1814
1815   scrollView.SetOvershootEnabled(true);
1816   DALI_TEST_CHECK(scrollView.IsOvershootEnabled());
1817
1818   scrollView.SetOvershootEnabled(false);
1819   DALI_TEST_CHECK(!scrollView.IsOvershootEnabled());
1820
1821   END_TEST;
1822 }
1823
1824 int UtcDaliToolkitScrollViewSetOvershootEffectColorP(void)
1825 {
1826   ToolkitTestApplication application;
1827   tet_infoline(" UtcDaliToolkitScrollViewSetOvershootEffectColorP");
1828
1829   ScrollView scrollView = ScrollView::New();
1830
1831   scrollView.SetOvershootEffectColor(Dali::Color::RED);
1832   DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::RED, TEST_LOCATION);
1833
1834   scrollView.SetOvershootEffectColor(Dali::Color::YELLOW);
1835   DALI_TEST_EQUALS(scrollView.GetOvershootEffectColor(), Dali::Color::YELLOW, TEST_LOCATION);
1836
1837   END_TEST;
1838 }
1839
1840 int UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP(void)
1841 {
1842   ToolkitTestApplication application;
1843   tet_infoline(" UtcDaliToolkitScrollViewSetOvershootAnimationSpeedP");
1844
1845   ScrollView scrollView = ScrollView::New();
1846
1847   scrollView.SetOvershootAnimationSpeed(55.0f);
1848   DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 55.0f, TEST_LOCATION);
1849
1850   scrollView.SetOvershootAnimationSpeed(120.0f);
1851   DALI_TEST_EQUALS(scrollView.GetOvershootAnimationSpeed(), 120.0f, TEST_LOCATION);
1852
1853   END_TEST;
1854 }
1855
1856 int UtcDaliToolkitScrollViewGetSet(void)
1857 {
1858   ToolkitTestApplication application;
1859   tet_infoline(" UtcDaliToolkitScrollViewGetSet");
1860   ScrollView scrollView = ScrollView::New();
1861   scrollView.SetMaxFlickSpeed(0.5f);
1862   DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1863   scrollView.SetFrictionCoefficient(0.6f);
1864   DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1865   scrollView.SetFlickSpeedCoefficient(0.7f);
1866   DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1867   END_TEST;
1868 }
1869
1870 int UtcDaliToolkitScrollViewRulerDomainConstructorP(void)
1871 {
1872   ToolkitTestApplication application;
1873
1874   RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
1875   DALI_TEST_EQUALS( domainX.min, 0.0f, TEST_LOCATION);
1876   DALI_TEST_EQUALS( domainX.max, 200.0f, TEST_LOCATION);
1877   DALI_TEST_EQUALS( domainX.enabled, true, TEST_LOCATION);
1878
1879   RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
1880   DALI_TEST_EQUALS( domainY.min, 100.0f, TEST_LOCATION);
1881   DALI_TEST_EQUALS( domainY.max, 500.0f, TEST_LOCATION);
1882   DALI_TEST_EQUALS( domainY.enabled, false, TEST_LOCATION);
1883
1884   END_TEST;
1885 }
1886
1887 int UtcDaliToolkitScrollViewRulerDomainGetSizeP(void)
1888 {
1889   ToolkitTestApplication application;
1890
1891   RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
1892   DALI_TEST_EQUALS( domainX.GetSize(), 200.0f, TEST_LOCATION);
1893
1894   RulerDomain domainY = RulerDomain(100.0f, 500.0f, false);
1895   DALI_TEST_EQUALS( domainY.GetSize(), 400.0f, TEST_LOCATION);
1896
1897   END_TEST;
1898 }
1899
1900 int UtcDaliToolkitScrollViewRulerDomainClampP(void)
1901 {
1902   ToolkitTestApplication application;
1903
1904   RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
1905
1906   float value = domainX.Clamp(50.0f, 100.0f, 1.0f);
1907   DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
1908
1909   value = domainX.Clamp(300.0f, 20.0f, 1.0f);
1910   DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
1911
1912   value = domainX.Clamp(300.0f, 20.0f, 0.5f);
1913   DALI_TEST_EQUALS( value, 80.0f, TEST_LOCATION);
1914
1915   value = domainX.Clamp(250.0f, 200.0f, 2.0f);
1916   DALI_TEST_EQUALS( value, 200.0f, TEST_LOCATION);
1917
1918   END_TEST;
1919 }
1920
1921 int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void)
1922 {
1923   ToolkitTestApplication application;
1924
1925   RulerDomain domainX = RulerDomain(0.0f, 200.0f, true);
1926
1927   ClampState clamped;
1928   float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped);
1929   DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION);
1930   DALI_TEST_EQUALS( clamped, Dali::Toolkit::NotClamped, TEST_LOCATION);
1931
1932   value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped);
1933   DALI_TEST_EQUALS( value, 0.0f, TEST_LOCATION);
1934   DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMin, TEST_LOCATION);
1935
1936   value = domainX.Clamp(300.0f, 20.0f, 1.0f, clamped);
1937   DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION);
1938   DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMax, TEST_LOCATION);
1939
1940   END_TEST;
1941 }
1942
1943 int UtcDaliToolkitScrollViewDefaultRulerConstructorP(void)
1944 {
1945   ToolkitTestApplication application;
1946   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerConstructorP");
1947
1948   RulerPtr defaultRuler = new DefaultRuler();
1949   DALI_TEST_CHECK( defaultRuler );
1950
1951   END_TEST;
1952 }
1953
1954 int UtcDaliToolkitScrollViewDefaultRulerDestructorP(void)
1955 {
1956   ToolkitTestApplication application;
1957   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerDestructorP");
1958
1959   RulerPtr defaultRuler = new DefaultRuler();
1960
1961   DALI_TEST_CHECK( true );
1962   END_TEST;
1963 }
1964
1965 int UtcDaliToolkitScrollViewFixedRulerConstructorP(void)
1966 {
1967   ToolkitTestApplication application;
1968   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerConstructorP");
1969
1970   RulerPtr fixedRuler = new FixedRuler( 100.0f );
1971   DALI_TEST_CHECK( fixedRuler );
1972
1973   fixedRuler = new FixedRuler( 0.0f );
1974   DALI_TEST_CHECK( fixedRuler );
1975
1976   END_TEST;
1977 }
1978
1979 int UtcDaliToolkitScrollViewFixedRulerDestructorP(void)
1980 {
1981   ToolkitTestApplication application;
1982   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerDestructorP");
1983
1984   RulerPtr fixedRuler = new FixedRuler( 100.0f );
1985
1986   DALI_TEST_CHECK( true );
1987   END_TEST;
1988 }
1989
1990 int UtcDaliToolkitScrollViewRulerGetTypeP(void)
1991 {
1992   ToolkitTestApplication application;
1993   tet_infoline(" UtcDaliToolkitScrollViewRulerGetTypeP");
1994
1995   RulerPtr defaultRuler = new DefaultRuler();
1996   DALI_TEST_CHECK( defaultRuler );
1997   DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::Free, TEST_LOCATION);
1998
1999   RulerPtr fixedRuler = new FixedRuler( 100.0f );
2000   DALI_TEST_CHECK( fixedRuler );
2001   DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::Fixed, TEST_LOCATION);
2002
2003   END_TEST;
2004 }
2005
2006 int UtcDaliToolkitScrollViewRulerGetExtensionP(void)
2007 {
2008   ToolkitTestApplication application;
2009   tet_infoline(" UtcDaliToolkitScrollViewRulerGetExtensionP");
2010
2011   RulerPtr defaultRuler = new DefaultRuler();
2012   DALI_TEST_CHECK( defaultRuler );
2013   DALI_TEST_CHECK( !defaultRuler->GetExtension() );
2014
2015   RulerPtr fixedRuler = new FixedRuler( 100.0f );
2016   DALI_TEST_CHECK( fixedRuler );
2017   DALI_TEST_CHECK( !fixedRuler->GetExtension() );
2018
2019   END_TEST;
2020 }
2021
2022 int UtcDaliToolkitScrollViewRulerEnableDisable(void)
2023 {
2024   ToolkitTestApplication application;
2025   tet_infoline(" UtcDaliToolkitScrollViewRulerEnableDisable");
2026
2027   RulerPtr ruler = new DefaultRuler();
2028
2029   DALI_TEST_CHECK( ruler->IsEnabled() );
2030   ruler->Disable();
2031   DALI_TEST_CHECK( !ruler->IsEnabled() );
2032   ruler->Enable();
2033   DALI_TEST_CHECK( ruler->IsEnabled() );
2034   END_TEST;
2035 }
2036
2037 int UtcDaliToolkitScrollViewRulerDomainEnableDisable(void)
2038 {
2039   ToolkitTestApplication application;
2040   tet_infoline(" UtcDaliToolkitScrollViewRulerDomainEnableDisable");
2041
2042   RulerPtr ruler = new DefaultRuler();
2043   DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2044
2045   ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) );
2046   DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION );
2047   DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION );
2048   DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION );
2049
2050   ruler->DisableDomain();
2051   DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
2052   DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION );
2053   DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION );
2054   END_TEST;
2055 }
2056
2057 int UtcDaliToolkitScrollViewRulerSnapAndClamp(void)
2058 {
2059   ToolkitTestApplication application;
2060   tet_infoline(" UtcDaliToolkitScrollViewRulerSnapAndClamp");
2061
2062   RulerPtr ruler = new FixedRuler( 50.0f );
2063   ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2064
2065   // default testing. (snap and clamp)
2066   DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION);
2067   DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION);
2068   DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION);
2069   DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION);
2070   DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION);
2071   DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION);
2072
2073   // bias testing.
2074   DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2075   DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick
2076   DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2077
2078   DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
2079   DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick
2080   DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
2081
2082   // length testing.
2083   DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary)
2084   DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary)
2085   DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary)
2086   DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary)
2087   DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary)
2088
2089   // scale testing.
2090   DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION);
2091   DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION);
2092   DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION);
2093   DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION);
2094
2095   // clamp state testing.
2096   ClampState clamped;
2097   DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2098   DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2099   DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
2100   DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2101   DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2102   DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2103   DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
2104   DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION );
2105   DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2106   DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
2107   DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
2108   DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION );
2109   END_TEST;
2110 }
2111
2112 int UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP(void)
2113 {
2114   ToolkitTestApplication application;
2115   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP");
2116
2117   RulerPtr rulerNormal = new FixedRuler( 25.0f );
2118   rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) );
2119
2120   unsigned int volume;
2121   float position;
2122
2123   position = rulerNormal->GetPositionFromPage(1, volume, true);
2124   DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION );
2125   DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2126
2127   position = rulerNormal->GetPositionFromPage(2, volume, true);
2128   DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION );
2129   DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
2130
2131   // Disable the ruler
2132   rulerNormal->Disable();
2133
2134   position = rulerNormal->GetPositionFromPage(1, volume, true);
2135   DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2136   DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION );
2137
2138   position = rulerNormal->GetPositionFromPage(2, volume, true);
2139   DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
2140   DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION );
2141
2142   END_TEST;
2143 }
2144
2145 int UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP(void)
2146 {
2147   ToolkitTestApplication application;
2148   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetTotalPagesP");
2149
2150   RulerPtr defaultRuler = new DefaultRuler();
2151   DALI_TEST_CHECK( defaultRuler );
2152   DALI_TEST_EQUALS( defaultRuler->GetTotalPages(), 1u, TEST_LOCATION);
2153
2154   END_TEST;
2155 }
2156
2157 int UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP(void)
2158 {
2159   ToolkitTestApplication application;
2160   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPageFromPositionP");
2161
2162   RulerPtr defaultRuler = new DefaultRuler();
2163   DALI_TEST_CHECK( defaultRuler );
2164   DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(100.0f, true), 0u, TEST_LOCATION);
2165   DALI_TEST_EQUALS( defaultRuler->GetPageFromPosition(-300.0f, false), 0u, TEST_LOCATION);
2166
2167   END_TEST;
2168 }
2169
2170 int UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP(void)
2171 {
2172   ToolkitTestApplication application;
2173   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerGetPositionFromPageP");
2174
2175   RulerPtr defaultRuler = new DefaultRuler();
2176   DALI_TEST_CHECK( defaultRuler );
2177
2178   unsigned int volume;
2179   DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(0, volume, true), 0.0f, TEST_LOCATION);
2180   DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2181
2182   DALI_TEST_EQUALS( defaultRuler->GetPositionFromPage(3, volume, false), 0.0f, TEST_LOCATION);
2183   DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION);
2184
2185   END_TEST;
2186 }
2187
2188 int UtcDaliToolkitScrollViewDefaultRulerSnapP(void)
2189 {
2190   ToolkitTestApplication application;
2191   tet_infoline(" UtcDaliToolkitScrollViewDefaultRulerSnapP");
2192
2193   RulerPtr defaultRuler = new DefaultRuler();
2194   DALI_TEST_CHECK( defaultRuler );
2195
2196   DALI_TEST_EQUALS( defaultRuler->Snap(50.0f, 0.5f), 50.0f, TEST_LOCATION);
2197   DALI_TEST_EQUALS( defaultRuler->Snap(-120.0f, 1.0f), -120.0f, TEST_LOCATION);
2198
2199   END_TEST;
2200 }
2201
2202 int UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP(void)
2203 {
2204   ToolkitTestApplication application;
2205   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetTotalPagesP");
2206
2207   RulerPtr fixedRuler = new FixedRuler( 100.0f );
2208   fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2209
2210   fixedRuler->Enable();
2211   DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 4u, TEST_LOCATION);
2212
2213   fixedRuler->Disable();
2214   DALI_TEST_EQUALS( fixedRuler->GetTotalPages(), 1u, TEST_LOCATION);
2215
2216   END_TEST;
2217 }
2218
2219 int UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP(void)
2220 {
2221   ToolkitTestApplication application;
2222   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP");
2223
2224   RulerPtr fixedRuler = new FixedRuler( 100.0f );
2225   fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2226
2227   fixedRuler->Enable();
2228   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 3u, TEST_LOCATION);
2229   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2230   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 1u, TEST_LOCATION);
2231   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2232
2233   fixedRuler->Disable();
2234   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2235   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2236   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2237   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2238
2239   // Set domain size to be smaller than the ruler space
2240   fixedRuler->SetDomain( RulerDomain(0.0f, 50.0f, true) );
2241
2242   fixedRuler->Enable();
2243   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2244   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION);
2245   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2246   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2247
2248   fixedRuler->Disable();
2249   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION);
2250   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION);
2251   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION);
2252   DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION);
2253
2254   END_TEST;
2255 }
2256
2257 int UtcDaliToolkitScrollViewFixedRulerSnapP(void)
2258 {
2259   ToolkitTestApplication application;
2260   tet_infoline(" UtcDaliToolkitScrollViewFixedRulerSnapP");
2261
2262   RulerPtr fixedRuler = new FixedRuler( 100.0f );
2263   fixedRuler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
2264
2265   DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.0f), -100.0f, TEST_LOCATION);
2266   DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.0f), -100.0f, TEST_LOCATION);
2267   DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.0f), -200.0f, TEST_LOCATION);
2268   DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.0f), -500.0f, TEST_LOCATION);
2269   DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.0f), 0.0f, TEST_LOCATION);
2270   DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.0f), 0.0f, TEST_LOCATION);
2271   DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.0f), 0.0f, TEST_LOCATION);
2272   DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.0f), 100.0f, TEST_LOCATION);
2273   DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.0f), 100.0f, TEST_LOCATION);
2274   DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.0f), 200.0f, TEST_LOCATION);
2275   DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.0f), 600.0f, TEST_LOCATION);
2276
2277   DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 0.5f), 0.0f, TEST_LOCATION);
2278   DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 0.5f), -100.0f, TEST_LOCATION);
2279   DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 0.5f), -100.0f, TEST_LOCATION);
2280   DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 0.5f), -500.0f, TEST_LOCATION);
2281   DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 0.5f), 0.0f, TEST_LOCATION);
2282   DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 0.5f), 100.0f, TEST_LOCATION);
2283   DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 0.5f), 100.0f, TEST_LOCATION);
2284   DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 0.5f), 100.0f, TEST_LOCATION);
2285   DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 0.5f), 100.0f, TEST_LOCATION);
2286   DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 0.5f), 300.0f, TEST_LOCATION);
2287   DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 0.5f), 600.0f, TEST_LOCATION);
2288
2289   DALI_TEST_EQUALS( fixedRuler->Snap(-30.0f, 1.0f), 0.0f, TEST_LOCATION);
2290   DALI_TEST_EQUALS( fixedRuler->Snap(-70.0f, 1.0f), 0.0f, TEST_LOCATION);
2291   DALI_TEST_EQUALS( fixedRuler->Snap(-120.0f, 1.0f), -100.0f, TEST_LOCATION);
2292   DALI_TEST_EQUALS( fixedRuler->Snap(-480.0f, 1.0f), -400.0f, TEST_LOCATION);
2293   DALI_TEST_EQUALS( fixedRuler->Snap(20.0f, 1.0f), 100.0f, TEST_LOCATION);
2294   DALI_TEST_EQUALS( fixedRuler->Snap(50.0f, 1.0f), 100.0f, TEST_LOCATION);
2295   DALI_TEST_EQUALS( fixedRuler->Snap(80.0f, 1.0f), 100.0f, TEST_LOCATION);
2296   DALI_TEST_EQUALS( fixedRuler->Snap(100.0f, 1.0f), 200.0f, TEST_LOCATION);
2297   DALI_TEST_EQUALS( fixedRuler->Snap(120.0f, 1.0f), 200.0f, TEST_LOCATION);
2298   DALI_TEST_EQUALS( fixedRuler->Snap(250.0f, 1.0f), 300.0f, TEST_LOCATION);
2299   DALI_TEST_EQUALS( fixedRuler->Snap(620.0f, 1.0f), 700.0f, TEST_LOCATION);
2300
2301   END_TEST;
2302 }
2303
2304 int UtcDaliToolkitScrollViewConstraintsMove(void)
2305 {
2306   ToolkitTestApplication application;
2307   tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove");
2308
2309   // Set up a scrollView...
2310   ScrollView scrollView = ScrollView::New();
2311   Stage::GetCurrent().Add( scrollView );
2312   Vector2 stageSize = Stage::GetCurrent().GetSize();
2313   scrollView.SetSize(stageSize);
2314   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2315   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2316
2317   // Position rulers.
2318   RulerPtr rulerX = new DefaultRuler();
2319   RulerPtr rulerY = new DefaultRuler();
2320   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2321   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2322   scrollView.SetRulerX(rulerX);
2323   scrollView.SetRulerY(rulerY);
2324
2325   // Add an Actor to ScrollView,
2326   Actor a = Actor::New();
2327   scrollView.Add(a);
2328   a.SetPosition( TEST_ACTOR_POSITION );
2329   Wait(application);
2330
2331   const Vector2 target = Vector2(100.0f, 100.0f);
2332   const Vector2 target2 = Vector2(200.0f, 200.0f);
2333
2334   Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, MoveActorConstraint );
2335   constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
2336   constraint.SetRemoveAction(Constraint::Discard);
2337   scrollView.ApplyConstraintToChildren(constraint);
2338
2339   scrollView.ScrollTo( target, 0.0f );
2340   Wait(application);
2341   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2342   scrollView.ScrollTo( target2 );
2343   Wait(application, RENDER_DELAY_SCROLL);
2344   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2345
2346   END_TEST;
2347 }
2348
2349 int UtcDaliToolkitScrollViewConstraintsWrap(void)
2350 {
2351   ToolkitTestApplication application;
2352   tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap");
2353
2354   // Set up a scrollView...
2355   ScrollView scrollView = ScrollView::New();
2356   Stage::GetCurrent().Add( scrollView );
2357   Vector2 stageSize = Stage::GetCurrent().GetSize();
2358   scrollView.SetSize(stageSize);
2359   scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
2360   scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2361
2362   // Position rulers.
2363   RulerPtr rulerX = new DefaultRuler();
2364   RulerPtr rulerY = new DefaultRuler();
2365   rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
2366   rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
2367   scrollView.SetRulerX(rulerX);
2368   scrollView.SetRulerY(rulerY);
2369
2370   // Add an Actor to ScrollView,
2371   Actor a = Actor::New();
2372   scrollView.Add(a);
2373   a.SetPosition( TEST_ACTOR_POSITION );
2374   Wait(application);
2375
2376   const Vector2 target = Vector2(100.0f, 100.0f);
2377   const Vector2 target2 = Vector2(200.0f, 200.0f);
2378
2379   Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, WrapActorConstraint );
2380   constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
2381   constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
2382   constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
2383   constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
2384   constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
2385   constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) );
2386   constraint.SetRemoveAction(Constraint::Discard);
2387   scrollView.ApplyConstraintToChildren(constraint);
2388
2389   scrollView.ScrollTo( target, 0.0f );
2390   Wait(application);
2391   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
2392   scrollView.ScrollTo( target2 );
2393   Wait(application, RENDER_DELAY_SCROLL);
2394   DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
2395
2396   scrollView.Remove(a);
2397   Wait(application);
2398
2399   END_TEST;
2400 }
2401
2402 // Non-API test (so no P or N variant).
2403 int UtcDaliToolkitScrollViewGesturePageLimit(void)
2404 {
2405   ToolkitTestApplication application;
2406   tet_infoline( " UtcDaliToolkitScrollViewGesturePageLimit" );
2407
2408   // Set up a scrollView.
2409   ScrollView scrollView = ScrollView::New();
2410
2411   // Do not rely on stage size for UTC tests.
2412   Vector2 pageSize( 720.0f, 1280.0f );
2413   scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
2414   scrollView.SetSize( pageSize );
2415   scrollView.SetParentOrigin( ParentOrigin::CENTER );
2416   scrollView.SetAnchorPoint( AnchorPoint::CENTER );
2417   scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
2418
2419   // Position rulers.
2420   // We set the X ruler to fixed to give us pages to snap to.
2421   Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( pageSize.width );
2422   // Note: The 3x page width is arbitary, but we need enough to show that we are
2423   // capping page movement by the page limiter, and not the domain.
2424   rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, pageSize.width * 3.0f, false ) );
2425   Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler();
2426   rulerY->Disable();
2427   scrollView.SetRulerX( rulerX );
2428   scrollView.SetRulerY( rulerY );
2429
2430   scrollView.SetWrapMode( false );
2431   scrollView.SetScrollSensitive( true );
2432
2433   Stage::GetCurrent().Add( scrollView );
2434
2435   // Set up a gesture to perform.
2436   Vector2 startPos( 50.0f, 0.0f );
2437   Vector2 direction( -5.0f, 0.0f );
2438   int frames = 200;
2439
2440   // Force starting position.
2441   scrollView.ScrollTo( startPos, 0.0f );
2442   Wait( application );
2443
2444   // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins.
2445   Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) );
2446
2447   // Confirm the final X coord has not moved more than one page from the start X position.
2448   DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
2449
2450   // Finish the gesture and wait for the snap.
2451   currentPos += direction;
2452   SendPan( application, Gesture::Finished, currentPos );
2453   // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first.
2454   Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
2455
2456   // Confirm the final X coord has snapped to exactly one page ahead of the start page.
2457   DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2458
2459   END_TEST;
2460 }
2461
2462 int UtcDaliScrollViewSetGetProperty(void)
2463 {
2464   ToolkitTestApplication application;
2465
2466   // Create the ScrollView actor
2467   ScrollView scrollView = ScrollView::New();
2468   DALI_TEST_CHECK(scrollView);
2469
2470   // Event side properties
2471
2472   // Test "wrapEnabled" property
2473   DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED );
2474   scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true );
2475   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get<bool>(), true, TEST_LOCATION );
2476
2477   // Test "panningEnabled" property
2478   DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED );
2479   scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false );
2480   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get<bool>(), false, TEST_LOCATION );
2481
2482   // Test "axisAutoLockEnabled" property
2483   DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED );
2484   scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false );
2485   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get<bool>(), false, TEST_LOCATION );
2486
2487   // Test "wheelScrollDistanceStep" property
2488   DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP );
2489   scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) );
2490   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<Vector2>(), Vector2(100.0f, 50.0f), TEST_LOCATION );
2491
2492   // Test "overshootEnabled" property
2493   DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED  );
2494   DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), scrollView.IsOvershootEnabled(), TEST_LOCATION );
2495   scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
2496   DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
2497
2498   // Animatable properties
2499
2500   // Test "scrollPosition" property
2501   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION );
2502   scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) );
2503   Wait(application);
2504   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get<Vector2>(), Vector2(320.0f, 550.0f), TEST_LOCATION );
2505
2506   // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties
2507   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION );
2508   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) );
2509   Wait(application);
2510   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(300.0f, 500.0f), TEST_LOCATION );
2511
2512   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X );
2513   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y );
2514   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 300.0f, TEST_LOCATION );
2515   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 500.0f, TEST_LOCATION );
2516   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f );
2517   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f );
2518   Wait(application);
2519   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 400.0f, TEST_LOCATION );
2520   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 600.0f, TEST_LOCATION );
2521   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(400.0f, 600.0f), TEST_LOCATION );
2522
2523   // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties
2524   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX );
2525   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) );
2526   Wait(application);
2527   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(100.0f, 200.0f), TEST_LOCATION );
2528
2529   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X );
2530   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y );
2531   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 100.0f, TEST_LOCATION );
2532   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 200.0f, TEST_LOCATION );
2533   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f );
2534   scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f );
2535   Wait(application);
2536   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 300.0f, TEST_LOCATION );
2537   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 400.0f, TEST_LOCATION );
2538   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(300.0f, 400.0f), TEST_LOCATION );
2539
2540   // Test "overshootX" property
2541   DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X );
2542   scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f );
2543   Wait(application);
2544   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get<float>(), 0.8f, TEST_LOCATION );
2545
2546   // Test "overshootY" property
2547   DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y );
2548   scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f );
2549   Wait(application);
2550   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get<float>(), 0.8f, TEST_LOCATION );
2551
2552   // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties
2553   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL );
2554   scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) );
2555   Wait(application);
2556   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(200.0f, 300.0f), TEST_LOCATION );
2557
2558   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X );
2559   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y );
2560   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 200.0f, TEST_LOCATION );
2561   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 300.0f, TEST_LOCATION );
2562   scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f );
2563   scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f );
2564   Wait(application);
2565   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 500.0f, TEST_LOCATION );
2566   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 600.0f, TEST_LOCATION );
2567   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(500.0f, 600.0f), TEST_LOCATION );
2568
2569   // Test "wrap" property
2570   DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP );
2571   scrollView.SetProperty( ScrollView::Property::WRAP, false );
2572   Wait(application);
2573   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get<bool>(), false, TEST_LOCATION );
2574
2575   // Test "panning" property
2576   DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING );
2577   scrollView.SetProperty( ScrollView::Property::PANNING, true );
2578   Wait(application);
2579   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get<bool>(), true, TEST_LOCATION );
2580
2581   // Test "scrolling" property
2582   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING );
2583   scrollView.SetProperty( ScrollView::Property::SCROLLING, false );
2584   Wait(application);
2585   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get<bool>(), false, TEST_LOCATION );
2586
2587   // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties
2588   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE );
2589   scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) );
2590   Wait(application);
2591   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1200.0f, 1300.0f), TEST_LOCATION );
2592
2593   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
2594   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
2595   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1200.0f, TEST_LOCATION );
2596   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1300.0f, TEST_LOCATION );
2597   scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f );
2598   scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f );
2599   Wait(application);
2600   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1500.0f, TEST_LOCATION );
2601   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1600.0f, TEST_LOCATION );
2602   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1500.0f, 1600.0f), TEST_LOCATION );
2603
2604   // Test "scrollDomainOffset" property
2605   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET );
2606   scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) );
2607   Wait(application);
2608   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get<Vector2>(), Vector2(500.0f, 200.0f), TEST_LOCATION );
2609
2610   // Test "scrollPositionDelta" property
2611   DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA );
2612   scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) );
2613   Wait(application);
2614   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get<Vector2>(), Vector2(10.0f, 30.0f), TEST_LOCATION );
2615
2616   // Test "startPagePosition" property
2617   DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION );
2618   scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) );
2619   Wait(application);
2620   DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get<Vector3>(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION );
2621
2622   END_TEST;
2623 }