Add style name to indicator of ScrollBar
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ScrollBar.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 <string>
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali/integration-api/events/pan-gesture-event.h>
24
25 using namespace Dali;
26 using namespace Toolkit;
27
28 void dali_scrollbar_startup(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void dali_scrollbar_cleanup(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 namespace
39 {
40
41 const int RENDER_FRAME_INTERVAL = 16;                       ///< Duration of each frame in ms. (at approx 60FPS)
42
43 // Generate a PanGestureEvent to send to Core
44 Integration::PanGestureEvent GeneratePan(
45     Gesture::State state,
46     const Vector2& previousPosition,
47     const Vector2& currentPosition,
48     unsigned long timeDelta,
49     unsigned int numberOfTouches = 1)
50 {
51   Integration::PanGestureEvent pan(state);
52
53   pan.previousPosition = previousPosition;
54   pan.currentPosition = currentPosition;
55   pan.timeDelta = timeDelta;
56   pan.numberOfTouches = numberOfTouches;
57
58   return pan;
59 }
60
61 /**
62  * Helper to generate PanGestureEvent
63  *
64  * @param[in] application Application instance
65  * @param[in] state The Gesture State
66  * @param[in] pos The current position of touch.
67  */
68 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
69 {
70   static Vector2 last;
71
72   if( (state == Gesture::Started) ||
73       (state == Gesture::Possible) )
74   {
75     last.x = pos.x;
76     last.y = pos.y;
77   }
78
79   application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
80
81   last.x = pos.x;
82   last.y = pos.y;
83 }
84
85 /*
86  * Simulate time passed by.
87  *
88  * @note this will always process at least 1 frame (1/60 sec)
89  *
90  * @param application Test application instance
91  * @param duration Time to pass in milliseconds.
92  * @return The actual time passed in milliseconds
93  */
94 int Wait(ToolkitTestApplication& application, int duration = 0)
95 {
96   int time = 0;
97
98   for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
99   {
100     application.SendNotification();
101     application.Render(RENDER_FRAME_INTERVAL);
102     time += RENDER_FRAME_INTERVAL;
103   }
104
105   return time;
106 }
107
108 // Callback probes.
109
110 static bool gOnPanFinishedCalled;                         ///< Whether the PanFinished signal was invoked.
111 static bool gOnScrollPositionIntervalReachedSignalCalled;        ///< Whether the ScrollPositionIntervalReached signal was invoked.
112
113 /**
114  * Invoked when pan gesture is finished on the scroll indicator.
115  */
116 static void OnPanFinished()
117 {
118   gOnPanFinishedCalled = true;
119 }
120
121 struct CallbackFunctor
122 {
123   CallbackFunctor(bool* callbackFlag)
124   : mCallbackFlag( callbackFlag )
125   {
126   }
127
128   void operator()()
129   {
130     *mCallbackFlag = true;
131   }
132   bool* mCallbackFlag;
133 };
134
135 /**
136  * Invoked when the current scroll position of the scrollable content goes above or below the values
137  * specified by SCROLL_POSITION_INTERVALS property.
138  *
139  * @param[in] position The current scroll position.
140  */
141 static void OnScrollPositionIntervalReached( float position )
142 {
143   gOnScrollPositionIntervalReachedSignalCalled = true;
144 }
145
146 static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames)
147 {
148   gOnPanFinishedCalled = false;
149
150   // Now do a pan starting from (start) and heading (direction)
151   Vector2 pos(start);
152   SendPan(application, Gesture::Possible, pos);
153   SendPan(application, Gesture::Started, pos);
154   Wait(application);
155
156   for(int i = 0; i < frames; i++)
157   {
158     pos += direction; // Move in this direction
159     SendPan(application, Gesture::Continuing, pos);
160     Wait(application);
161   }
162
163   pos += direction; // Move in this direction.
164   SendPan(application, Gesture::Finished, pos);
165   Wait(application);
166
167   return pos;
168 }
169
170 } // namespace
171
172 int UtcDaliToolkitScrollBarConstructorP(void)
173 {
174   ToolkitTestApplication application;
175
176   ScrollBar scrollBar;
177   DALI_TEST_CHECK( !scrollBar );
178   END_TEST;
179 }
180
181 int UtcDaliToolkitScrollBarCopyConstructorP(void)
182 {
183   ToolkitTestApplication application;
184
185   ScrollBar scrollBar = ScrollBar::New();
186   scrollBar.SetProperty( ScrollBar::Property::INDICATOR_FIXED_HEIGHT, 38.2f );
187
188   ScrollBar copy( scrollBar );
189   DALI_TEST_CHECK( copy );
190   DALI_TEST_CHECK( copy.GetProperty<float>( ScrollBar::Property::INDICATOR_FIXED_HEIGHT ) == scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_FIXED_HEIGHT ) );
191   END_TEST;
192 }
193
194 int UtcDaliToolkitScrollBarAssignmentOperatorP(void)
195 {
196   ToolkitTestApplication application;
197
198   ScrollBar scrollBar = ScrollBar::New();
199   scrollBar.SetProperty( ScrollBar::Property::INDICATOR_FIXED_HEIGHT, 38.2f );
200
201   ScrollBar copy = scrollBar;
202   DALI_TEST_CHECK( copy );
203   DALI_TEST_CHECK( copy.GetProperty<float>( ScrollBar::Property::INDICATOR_FIXED_HEIGHT ) == scrollBar.GetProperty<float>( ScrollBar::Property::INDICATOR_FIXED_HEIGHT ) );
204   END_TEST;
205 }
206
207 int UtcDaliScrollBarDestructorP(void)
208 {
209   ToolkitTestApplication application;
210
211   ScrollBar* scrollBar = new ScrollBar();
212   delete scrollBar;
213
214   DALI_TEST_CHECK( true );
215   END_TEST;
216 }
217
218 int UtcDaliToolkitScrollBarNewP(void)
219 {
220   ToolkitTestApplication application;
221
222   ScrollBar scrollBar = ScrollBar::New();
223   DALI_TEST_CHECK( scrollBar );
224   END_TEST;
225
226   ScrollBar vertical = ScrollBar::New(ScrollBar::Vertical);
227   DALI_TEST_CHECK( vertical );
228   DALI_TEST_CHECK( vertical.GetScrollDirection() == ScrollBar::Vertical );
229
230   Property::Value value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
231   std::string scrollDirection = value.Get<std::string>();
232   DALI_TEST_EQUALS( scrollDirection, "Vertical", TEST_LOCATION );
233
234   ScrollBar horizontal = ScrollBar::New(ScrollBar::Horizontal);
235   DALI_TEST_CHECK( horizontal );
236   DALI_TEST_CHECK( horizontal.GetScrollDirection() == ScrollBar::Horizontal );
237   value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
238   scrollDirection = value.Get<std::string>();
239   DALI_TEST_EQUALS( scrollDirection, "Horizontal", TEST_LOCATION );
240
241   END_TEST;
242 }
243
244 int UtcDaliToolkitScrollBarCreateP(void)
245 {
246   ToolkitTestApplication application;
247
248   TypeRegistry typeRegistry = TypeRegistry::Get();
249   DALI_TEST_CHECK( typeRegistry );
250
251   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "ScrollBar" );
252   DALI_TEST_CHECK( typeInfo );
253
254   BaseHandle handle = typeInfo.CreateInstance();
255   DALI_TEST_CHECK( handle );
256
257   ScrollBar scrollBar = ScrollBar::DownCast( handle );
258   DALI_TEST_CHECK( scrollBar );
259
260   scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Vertical");
261   scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Fixed");
262
263   DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Vertical, TEST_LOCATION );
264   DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Fixed, TEST_LOCATION );
265
266   scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Horizontal");
267   scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Variable");
268
269   DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Horizontal, TEST_LOCATION );
270   DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Variable, TEST_LOCATION );
271
272   END_TEST;
273 }
274
275 int UtcDaliToolkitScrollBarDownCastP(void)
276 {
277   ToolkitTestApplication application;
278
279   ScrollBar scrollBar1 = ScrollBar::New();
280   BaseHandle object( scrollBar1 );
281
282   ScrollBar scrollBar2 = ScrollBar::DownCast( object );
283   DALI_TEST_CHECK( scrollBar2 );
284
285   ScrollBar scrollBar3 = DownCast< ScrollBar >( object );
286   DALI_TEST_CHECK( scrollBar3 );
287   END_TEST;
288 }
289
290 int UtcDaliToolkitScrollBarDownCastN(void)
291 {
292   ToolkitTestApplication application;
293
294   BaseHandle uninitializedObject;
295   ScrollBar scrollBar1 = ScrollBar::DownCast( uninitializedObject );
296   DALI_TEST_CHECK( !scrollBar1 );
297
298   ScrollBar scrollBar2 = DownCast< ScrollBar >( uninitializedObject );
299   DALI_TEST_CHECK( !scrollBar2 );
300   END_TEST;
301 }
302
303 int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void)
304 {
305   ToolkitTestApplication application;
306
307   // Create a vertical scroll bar
308   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
309   DALI_TEST_CHECK( scrollBar );
310   DALI_TEST_CHECK( scrollBar.GetScrollDirection() == ScrollBar::Vertical );
311
312   float scrollBarHeight = 100.0f;
313   scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f);
314   Stage::GetCurrent().Add( scrollBar );
315
316   // Create a source actor that owns the scroll properties required by the scroll bar
317   Actor sourceActor = Actor::New();
318   Stage::GetCurrent().Add( sourceActor );
319
320   // Register the scroll properties
321   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
322   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
323   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   100.0f );
324   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   500.0f );
325
326   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
327   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
328   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
329   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
330
331   // Set the source of the scroll position properties.
332   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
333
334   // Render and notify
335   application.SendNotification();
336   application.Render();
337
338   Actor indicator = scrollBar.GetScrollIndicator();
339   DALI_TEST_CHECK( indicator );
340
341   // Check that the indicator size should be: scroll bar size * (scroll bar size / content size).
342   // i.e. The bigger the content size, the smaller the indicator size
343   float indicatorHeight = indicator.GetCurrentSize().y;
344   DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION );
345
346   // Decrease the content length
347   sourceActor.SetProperty( propertyScrollContentSize, 250.0f );
348
349   // Render and notify
350   application.SendNotification();
351   application.Render();
352
353   // Check that the indicator size is changed accordingly
354   indicatorHeight = indicator.GetCurrentSize().y;
355   DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 250.0f, TEST_LOCATION );
356
357   // As scroll position is 0, check that the indicator position should be 0.0f.
358   float indicatorPosition = indicator.GetCurrentPosition().y;
359   DALI_TEST_EQUALS( indicatorPosition, 0.0f, TEST_LOCATION );
360
361   // Set the scroll position to the middle
362   sourceActor.SetProperty( propertyScrollPosition, -50.0f );
363
364   // Render and notify
365   application.SendNotification();
366   application.Render();
367
368   // Check that the indicator should be in the middle of the scroll bar
369   indicatorPosition = indicator.GetCurrentPosition().y;
370   DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.5f, TEST_LOCATION );
371
372   // Set the scroll position to the maximum
373   sourceActor.SetProperty( propertyScrollPosition, -100.0f );
374
375   // Render and notify
376   application.SendNotification();
377   application.Render();
378
379   // Check that the indicator should be in the end of the scroll bar
380   indicatorPosition = indicator.GetCurrentPosition().y;
381   DALI_TEST_EQUALS( indicatorPosition, scrollBarHeight - indicatorHeight, TEST_LOCATION );
382
383   // Increase the maximum scroll position to double
384   sourceActor.SetProperty( propertyMaxScrollPosition, 200.0f );
385
386   // Render and notify
387   application.SendNotification();
388   application.Render();
389
390   // Check that the indicator should be now in the middle of the scroll bar
391   indicatorPosition = indicator.GetCurrentPosition().y;
392   DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.5f, TEST_LOCATION );
393
394   // Create another source actor
395   Actor newSourceActor = Actor::New();
396   Stage::GetCurrent().Add( newSourceActor );
397
398   // Register the scroll properties
399   Property::Index newPropertyScrollPosition = newSourceActor.RegisterProperty( "sourcePosition",  0.0f );
400   Property::Index newPropertyMinScrollPosition = newSourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
401   Property::Index newPropertyMaxScrollPosition = newSourceActor.RegisterProperty( "sourcePositionMax",   200.0f );
402   Property::Index newPropertyScrollContentSize = newSourceActor.RegisterProperty( "sourceContentSize",   400.0f );
403
404   DALI_TEST_EQUALS( newSourceActor.GetPropertyIndex( "sourcePosition" ), newPropertyScrollPosition, TEST_LOCATION );
405   DALI_TEST_EQUALS( newSourceActor.GetPropertyIndex( "sourcePositionMin" ), newPropertyMinScrollPosition, TEST_LOCATION );
406   DALI_TEST_EQUALS( newSourceActor.GetPropertyIndex( "sourcePositionMax" ), newPropertyMaxScrollPosition, TEST_LOCATION );
407   DALI_TEST_EQUALS( newSourceActor.GetPropertyIndex( "sourceContentSize" ), newPropertyScrollContentSize, TEST_LOCATION );
408
409   // Change the source of the scroll position properties to be the new source actor.
410   scrollBar.SetScrollPropertySource(newSourceActor, newPropertyScrollPosition, newPropertyMinScrollPosition, newPropertyMaxScrollPosition, newPropertyScrollContentSize);
411
412   // Render and notify
413   application.SendNotification();
414   application.Render();
415
416   // Check that the indicator size is changed accordingly
417   indicatorHeight = indicator.GetCurrentSize().y;
418   DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 400.0f, TEST_LOCATION );
419
420   // Check that the indicator position goes back to the beginning of the scroll bar
421   indicatorPosition = indicator.GetCurrentPosition().y;
422   DALI_TEST_EQUALS( indicatorPosition, 0.0f, TEST_LOCATION );
423
424   // Set the scroll position to one fifth of the maximum
425   newSourceActor.SetProperty( propertyScrollPosition, -40.0f );
426
427   // Render and notify
428   application.SendNotification();
429   application.Render();
430
431   // Check that the indicator should be in one fifth from the beginning of the scroll bar
432   indicatorPosition = indicator.GetCurrentPosition().y;
433   DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.2f, TEST_LOCATION );
434
435   END_TEST;
436 }
437
438 int UtcDaliToolkitScrollBarSetScrollPropertySourceN(void)
439 {
440   ToolkitTestApplication application;
441
442   // Create a scroll bar
443   ScrollBar scrollBar = ScrollBar::New();
444   DALI_TEST_CHECK( scrollBar );
445
446   // Set empty handle of source object and invalid source property index.
447   Actor sourceActor;
448   scrollBar.SetScrollPropertySource(sourceActor, Property::INVALID_INDEX, Property::INVALID_INDEX, Property::INVALID_INDEX, Property::INVALID_INDEX);
449
450   DALI_TEST_CHECK( true );
451   END_TEST;
452 }
453
454 int UtcDaliToolkitScrollBarSetScrollIndicatorP(void)
455 {
456   ToolkitTestApplication application;
457
458   // Create a scroll bar
459   ScrollBar scrollBar = ScrollBar::New();
460   DALI_TEST_CHECK( scrollBar );
461
462   Actor indicator = scrollBar.GetScrollIndicator();
463   DALI_TEST_CHECK( indicator );
464
465   // Set a new indicator
466   Actor newIndicator = Actor::New();
467   scrollBar.SetScrollIndicator(newIndicator);
468
469   // Check that the new indicator is successfully set
470   DALI_TEST_CHECK( indicator != scrollBar.GetScrollIndicator() );
471   DALI_TEST_CHECK( newIndicator == scrollBar.GetScrollIndicator() );
472
473   // Check that the new control indicator is successfully set
474   Control controlIndicator = Control::New();
475   scrollBar.SetScrollIndicator(controlIndicator);
476
477   DALI_TEST_CHECK( controlIndicator == Control::DownCast( scrollBar.GetScrollIndicator() ) );
478   END_TEST;
479 }
480
481 int UtcDaliToolkitScrollBarSetScrollIndicatorN(void)
482 {
483   ToolkitTestApplication application;
484
485   // Create a scroll bar
486   ScrollBar scrollBar = ScrollBar::New();
487   DALI_TEST_CHECK( scrollBar );
488
489   Actor indicator = scrollBar.GetScrollIndicator();
490   DALI_TEST_CHECK( indicator );
491
492   // Try to set an uninitialized actor as the indicator
493   Actor uninitializedIndicator;
494   scrollBar.SetScrollIndicator(uninitializedIndicator);
495
496   // Check that the uninitialized actor can not be set as the indicator
497   DALI_TEST_CHECK( indicator == scrollBar.GetScrollIndicator() );
498   DALI_TEST_CHECK( uninitializedIndicator != scrollBar.GetScrollIndicator() );
499
500   END_TEST;
501 }
502
503 int UtcDaliToolkitScrollBarGetScrollIndicatorP(void)
504 {
505   ToolkitTestApplication application;
506
507   // Create a scroll bar
508   ScrollBar scrollBar = ScrollBar::New();
509   DALI_TEST_CHECK( scrollBar );
510
511   Actor indicator = scrollBar.GetScrollIndicator();
512   DALI_TEST_CHECK( indicator );
513
514   // Set a new indicator
515   Actor newIndicator = Actor::New();
516   scrollBar.SetScrollIndicator(newIndicator);
517
518   // Check that the new indicator is successfully set
519   DALI_TEST_CHECK( scrollBar.GetScrollIndicator() );
520   DALI_TEST_CHECK( indicator != scrollBar.GetScrollIndicator() );
521   DALI_TEST_CHECK( newIndicator == scrollBar.GetScrollIndicator() );
522
523   END_TEST;
524 }
525
526 int UtcDaliToolkitScrollBarGetScrollIndicatorN(void)
527 {
528   ToolkitTestApplication application;
529
530   // Create a scroll bar
531   ScrollBar scrollBar = ScrollBar::New();
532   DALI_TEST_CHECK( scrollBar );
533
534   Actor indicator = scrollBar.GetScrollIndicator();
535   DALI_TEST_CHECK( indicator );
536
537   // Try to set an uninitialized actor as the indicator
538   Actor uninitializedIndicator;
539   scrollBar.SetScrollIndicator(uninitializedIndicator);
540
541   // Check that the indicator has not been changed
542   DALI_TEST_CHECK( indicator == scrollBar.GetScrollIndicator() );
543   DALI_TEST_CHECK( uninitializedIndicator != scrollBar.GetScrollIndicator() );
544
545   END_TEST;
546 }
547
548 int UtcDaliToolkitScrollBarSetScrollPositionIntervalsP(void)
549 {
550   ToolkitTestApplication application;
551
552   // Create a vertical scroll bar
553   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
554   DALI_TEST_CHECK( scrollBar );
555
556   scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
557   scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT);
558   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
559
560   Stage::GetCurrent().Add( scrollBar );
561
562   // Connect to the ScrollPositionIntervalReached signal
563   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
564
565   // Render and notify
566   application.SendNotification();
567   application.Render();
568
569   // Create a source actor that owns the scroll properties required by the scroll bar
570   Actor sourceActor = Actor::New();
571   Stage::GetCurrent().Add( sourceActor );
572
573   // Register the scroll properties
574   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
575   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
576   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   800.0f );
577   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   2000.0f );
578
579   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
580   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
581   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
582   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
583
584   // Set the source of the scroll position properties.
585   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
586
587   // Render and notify
588   application.SendNotification();
589   application.Render();
590
591   // Set the values to get notified when the scroll positions of the source actor goes above or below these values
592   Dali::Vector<float> positionIntervals;
593   for( size_t i = 0; i != 10; ++i )
594   {
595     positionIntervals.PushBack( -80.0f * i ); // should get notified for each 80 pixels
596   }
597   scrollBar.SetScrollPositionIntervals(positionIntervals);
598
599   // Get the list of scroll position intervals for notification
600   Dali::Vector<float> results = scrollBar.GetScrollPositionIntervals();
601
602   // Check that the result is the same as the list previously set.
603   DALI_TEST_EQUALS( positionIntervals.Count(), results.Count(), TEST_LOCATION );
604   DALI_TEST_EQUALS( positionIntervals[0], results[0], TEST_LOCATION );
605   DALI_TEST_EQUALS( positionIntervals[1], results[1], TEST_LOCATION );
606   DALI_TEST_EQUALS( positionIntervals[2], results[2], TEST_LOCATION );
607   DALI_TEST_EQUALS( positionIntervals[3], results[3], TEST_LOCATION );
608   DALI_TEST_EQUALS( positionIntervals[4], results[4], TEST_LOCATION );
609   DALI_TEST_EQUALS( positionIntervals[5], results[5], TEST_LOCATION );
610   DALI_TEST_EQUALS( positionIntervals[6], results[6], TEST_LOCATION );
611   DALI_TEST_EQUALS( positionIntervals[7], results[7], TEST_LOCATION );
612   DALI_TEST_EQUALS( positionIntervals[8], results[8], TEST_LOCATION );
613   DALI_TEST_EQUALS( positionIntervals[9], results[9], TEST_LOCATION );
614
615   // Reset the flag
616   gOnScrollPositionIntervalReachedSignalCalled = false;
617
618   // Animate the scroll position to cross the specified value
619   Animation animation = Animation::New(0.1f);
620   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -85.0f );
621   animation.Play();
622
623   // Wait for 0.1 second
624   Wait(application, 100);
625
626   // Check that the signal callback is called
627   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
628
629   // Reset the flag
630   gOnScrollPositionIntervalReachedSignalCalled = false;
631
632   // Rest and clear the animation
633   animation.Clear();
634   animation.Reset();
635
636   // Animate the scroll position to cross another specified value
637   animation = Animation::New(0.1f);
638   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -170.0f );
639   animation.Play();
640
641   // Wait for 0.1 second
642   Wait(application, 100);
643
644   // Check that the signal callback is called
645   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
646
647   // Reset the flag
648   gOnScrollPositionIntervalReachedSignalCalled = false;
649
650   // Rest and clear the animation
651   animation.Clear();
652   animation.Reset();
653
654   // Animate the scroll position back to the previous value
655   animation = Animation::New(0.1f);
656   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -85.0f );
657   animation.Play();
658
659   // Wait for 0.1 second
660   Wait(application, 100);
661
662   // Check that the signal callback is called
663   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
664
665   END_TEST;
666 }
667
668 int UtcDaliToolkitScrollBarGetScrollPositionIntervalsP(void)
669 {
670   ToolkitTestApplication application;
671
672   // Create a vertical scroll bar
673   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
674   DALI_TEST_CHECK( scrollBar );
675
676   // Set the values to get notified when the scroll positions of the source actor goes above or below these values
677   Dali::Vector<float> positionIntervals;
678   for( size_t i = 0; i != 10; ++i )
679   {
680     positionIntervals.PushBack( -80.0f * i ); // should get notified for each 80 pixels
681   }
682   scrollBar.SetScrollPositionIntervals(positionIntervals);
683
684   // Get the list of scroll position intervals for notification
685   Dali::Vector<float> results = scrollBar.GetScrollPositionIntervals();
686
687   // Check that the result is the same as the list previously set.
688   DALI_TEST_EQUALS( positionIntervals.Count(), results.Count(), TEST_LOCATION );
689   DALI_TEST_EQUALS( positionIntervals[0], results[0], TEST_LOCATION );
690   DALI_TEST_EQUALS( positionIntervals[1], results[1], TEST_LOCATION );
691   DALI_TEST_EQUALS( positionIntervals[2], results[2], TEST_LOCATION );
692   DALI_TEST_EQUALS( positionIntervals[3], results[3], TEST_LOCATION );
693   DALI_TEST_EQUALS( positionIntervals[4], results[4], TEST_LOCATION );
694   DALI_TEST_EQUALS( positionIntervals[5], results[5], TEST_LOCATION );
695   DALI_TEST_EQUALS( positionIntervals[6], results[6], TEST_LOCATION );
696   DALI_TEST_EQUALS( positionIntervals[7], results[7], TEST_LOCATION );
697   DALI_TEST_EQUALS( positionIntervals[8], results[8], TEST_LOCATION );
698   DALI_TEST_EQUALS( positionIntervals[9], results[9], TEST_LOCATION );
699
700   END_TEST;
701 }
702
703 int UtcDaliToolkitScrollBarGetScrollDirectionP(void)
704 {
705   ToolkitTestApplication application;
706
707   // Create a vertical scroll bar
708   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
709   DALI_TEST_CHECK( scrollBar );
710   DALI_TEST_CHECK( scrollBar.GetScrollDirection() == ScrollBar::Vertical );
711
712   // Change the direction of scroll bar to horizontal
713   scrollBar.SetScrollDirection(ScrollBar::Horizontal);
714   DALI_TEST_CHECK( scrollBar.GetScrollDirection() == ScrollBar::Horizontal );
715
716   END_TEST;
717 }
718
719 int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void)
720 {
721   ToolkitTestApplication application;
722
723   // Create a scroll bar
724   ScrollBar scrollBar = ScrollBar::New();
725   DALI_TEST_CHECK( scrollBar );
726
727   float scrollBarHeight = 100.0f;
728   scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f);
729   Stage::GetCurrent().Add( scrollBar );
730
731   // Create a source actor that owns the scroll properties required by the scroll bar
732   Actor sourceActor = Actor::New();
733   Stage::GetCurrent().Add( sourceActor );
734
735   // Register the scroll properties
736   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
737   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
738   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   100.0f );
739   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   500.0f );
740
741   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
742   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
743   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
744   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
745
746   // Set the source of the scroll position properties.
747   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
748
749   // Render and notify
750   application.SendNotification();
751   application.Render();
752
753   Actor indicator = scrollBar.GetScrollIndicator();
754   DALI_TEST_CHECK( indicator );
755
756   // Check that the indicator size should be: scroll bar size * (scroll bar size / content size).
757   // i.e. The bigger the content size, the smaller the indicator size
758   float indicatorHeight = indicator.GetCurrentSize().y;
759   DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION );
760
761   // Set the indicator height to be fixed to 50.0f
762   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
763   scrollBar.SetIndicatorFixedHeight(50.0f);
764
765   Property::Value value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
766   DALI_TEST_EQUALS(value.Get<std::string>(), "Fixed", TEST_LOCATION );
767
768   // Render and notify
769   application.SendNotification();
770   application.Render();
771
772   // Check that the indicator size should be 50.0f
773   indicatorHeight = indicator.GetCurrentSize().y;
774   DALI_TEST_EQUALS( indicatorHeight, 50.0f, TEST_LOCATION );
775
776   // Set the indicator height to be variable
777   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable);
778   value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
779   DALI_TEST_EQUALS(value.Get<std::string>(), "Variable", TEST_LOCATION );
780
781   // Render and notify
782   application.SendNotification();
783   application.Render();
784
785   // Check that the indicator size should be: scroll bar size * (scroll bar size / content size).
786   indicatorHeight = indicator.GetCurrentSize().y;
787   DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION );
788
789   END_TEST;
790 }
791
792 int UtcDaliToolkitScrollBarGetIndicatorHeightPolicyP(void)
793 {
794   ToolkitTestApplication application;
795
796   // Create a scroll bar
797   ScrollBar scrollBar = ScrollBar::New();
798   DALI_TEST_CHECK( scrollBar );
799
800   // Set the indicator height to be fixed
801   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
802   DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Fixed, TEST_LOCATION );
803
804   // Set the indicator height to be variable
805   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable);
806   DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Variable, TEST_LOCATION );
807
808   END_TEST;
809 }
810
811 int UtcDaliToolkitScrollBarSetIndicatorFixedHeightP(void)
812 {
813   ToolkitTestApplication application;
814
815   // Create a scroll bar
816   ScrollBar scrollBar = ScrollBar::New();
817   DALI_TEST_CHECK( scrollBar );
818
819   float scrollBarHeight = 100.0f;
820   scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f);
821   Stage::GetCurrent().Add( scrollBar );
822
823   Actor indicator = scrollBar.GetScrollIndicator();
824   DALI_TEST_CHECK( indicator );
825
826   // Set the indicator height to be fixed to 50.0f
827   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
828   scrollBar.SetIndicatorFixedHeight(50.0f);
829
830   // Render and notify
831   application.SendNotification();
832   application.Render();
833
834   // Check that the indicator size should be 50.0f
835   DALI_TEST_EQUALS( indicator.GetCurrentSize().y, 50.0f, TEST_LOCATION );
836
837   // Set the indicator height to be fixed to 25.0f
838   scrollBar.SetIndicatorFixedHeight(25.0f);
839
840   // Render and notify
841   application.SendNotification();
842   application.Render();
843
844   // Check that the indicator size should be 25.0f
845   DALI_TEST_EQUALS( indicator.GetCurrentSize().y, 25.0f, TEST_LOCATION );
846
847   END_TEST;
848 }
849
850 int UtcDaliToolkitScrollBarGetIndicatorFixedHeightP(void)
851 {
852   ToolkitTestApplication application;
853
854   // Create a scroll bar
855   ScrollBar scrollBar = ScrollBar::New();
856   DALI_TEST_CHECK( scrollBar );
857
858   // Set the fixed indicator height to be 50.0f
859   scrollBar.SetIndicatorFixedHeight(50.0f);
860
861   // Check that the indicator size should be 50.0f
862   DALI_TEST_EQUALS( scrollBar.GetIndicatorFixedHeight(), 50.0f, TEST_LOCATION );
863
864   // Set the indicator height to be fixed to 25.0f
865   scrollBar.SetIndicatorFixedHeight(25.0f);
866
867   // Check that the indicator size should be 50.0f
868   DALI_TEST_EQUALS( scrollBar.GetIndicatorFixedHeight(), 25.0f, TEST_LOCATION );
869
870   END_TEST;
871 }
872
873 int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void)
874 {
875   ToolkitTestApplication application;
876
877   // Create a scroll bar
878   ScrollBar scrollBar = ScrollBar::New();
879   DALI_TEST_CHECK( scrollBar );
880
881   Stage::GetCurrent().Add( scrollBar );
882
883   Actor indicator = scrollBar.GetScrollIndicator();
884   DALI_TEST_CHECK( indicator );
885
886   // Set the duration to show the indicator to be 0.35 second
887   scrollBar.SetIndicatorShowDuration(0.35);
888   DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.35f, TEST_LOCATION );
889
890   // Make the indicator invisible
891   indicator.SetOpacity(0.0f);
892
893   // Render and notify
894   application.SendNotification();
895   application.Render();
896
897   // Check that the indicator is invisible
898   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
899
900   // Show the indicator
901   scrollBar.ShowIndicator();
902
903   // Wait for 0.35 second
904   Wait(application, 350);
905
906   // Render and notify
907   application.SendNotification();
908   application.Render();
909
910   // Check that the indicator is now visible
911   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
912
913   // Set the duration to show the indicator to be 0.75 second
914   scrollBar.SetIndicatorShowDuration(0.75);
915   DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.75f, TEST_LOCATION );
916
917   // Make the indicator invisible
918   indicator.SetOpacity(0.0f);
919
920   // Render and notify
921   application.SendNotification();
922   application.Render();
923
924   // Check that the indicator is invisible
925   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
926
927   // Show the indicator
928   scrollBar.ShowIndicator();
929
930   // Wait for 0.35 second first
931   Wait(application, 350);
932
933   // Render and notify
934   application.SendNotification();
935   application.Render();
936
937   // Check that the indicator is not fully visible yet
938   DALI_TEST_CHECK( indicator.GetCurrentOpacity() != 1.0f );
939
940   // Wait for another 0.4 second
941   Wait(application, 400);
942
943   // Render and notify
944   application.SendNotification();
945   application.Render();
946
947   // Check that the indicator is now fully visible
948   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
949
950   END_TEST;
951 }
952
953 int UtcDaliToolkitScrollBarSetIndicatorShowDurationN(void)
954 {
955   ToolkitTestApplication application;
956
957   // Create a scroll bar
958   ScrollBar scrollBar = ScrollBar::New();
959   DALI_TEST_CHECK( scrollBar );
960
961   Stage::GetCurrent().Add( scrollBar );
962
963   Actor indicator = scrollBar.GetScrollIndicator();
964   DALI_TEST_CHECK( indicator );
965
966   // Get the default duration to show the indicator
967   float duration = scrollBar.GetIndicatorShowDuration();
968
969   // Check that the default duration is greater than 0
970   DALI_TEST_CHECK( duration > 0.0f );
971
972   // Make the indicator invisible
973   indicator.SetOpacity(0.0f);
974
975   // Render and notify
976   application.SendNotification();
977   application.Render();
978
979   // Check that the indicator is invisible
980   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
981
982   // Show the indicator
983   scrollBar.ShowIndicator();
984
985   // Wait for the specified duration
986   Wait(application, duration * 1000);
987
988   // Render and notify
989   application.SendNotification();
990   application.Render();
991
992   // Check that the indicator is now visible
993   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
994
995   // Now set the duration to show the indicator to be a negative value (which should be ignored and therefore means instant)
996   scrollBar.SetIndicatorShowDuration(-0.25f);
997   DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), -0.25f, TEST_LOCATION );
998
999   // Make the indicator invisible
1000   indicator.SetOpacity(0.0f);
1001
1002   // Render and notify
1003   application.SendNotification();
1004   application.Render();
1005
1006   // Check that the indicator is invisible
1007   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1008
1009   // Show the indicator
1010   scrollBar.ShowIndicator();
1011
1012   // Render and notify
1013   application.SendNotification();
1014   application.Render();
1015
1016   // Check that the indicator becomes instantly visible in the next frame
1017   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1018
1019   END_TEST;
1020 }
1021
1022 int UtcDaliToolkitScrollBarGetIndicatorShowDurationP(void)
1023 {
1024   ToolkitTestApplication application;
1025
1026   // Create a scroll bar
1027   ScrollBar scrollBar = ScrollBar::New();
1028   DALI_TEST_CHECK( scrollBar );
1029
1030   // Set the duration to show the indicator to be 0.35 second
1031   scrollBar.SetIndicatorShowDuration(0.35f);
1032
1033   // Check that the duration to show the indicator is 0.35 second
1034   DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.35f, TEST_LOCATION );
1035
1036   // Set the duration to show the indicator to be 0.75 second
1037   scrollBar.SetIndicatorShowDuration(0.75f);
1038
1039   // Check that the duration to show the indicator is 0.75 second
1040   DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.75f, TEST_LOCATION );
1041
1042   END_TEST;
1043 }
1044
1045 int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void)
1046 {
1047   ToolkitTestApplication application;
1048
1049   // Create a scroll bar
1050   ScrollBar scrollBar = ScrollBar::New();
1051   DALI_TEST_CHECK( scrollBar );
1052
1053   Stage::GetCurrent().Add( scrollBar );
1054
1055   Actor indicator = scrollBar.GetScrollIndicator();
1056   DALI_TEST_CHECK( indicator );
1057
1058   // Set the duration to hide the indicator to be 0.15 second
1059   scrollBar.SetIndicatorHideDuration(0.15f);
1060   DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.15f, TEST_LOCATION );
1061
1062   // Make the indicator visible
1063   indicator.SetOpacity(1.0f);
1064
1065   // Render and notify
1066   application.SendNotification();
1067   application.Render();
1068
1069   // Check that the indicator is visible
1070   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1071
1072   // Hide the indicator
1073   scrollBar.HideIndicator();
1074
1075   // Wait for 0.15 second
1076   Wait(application, 150);
1077
1078   // Render and notify
1079   application.SendNotification();
1080   application.Render();
1081
1082   // Check that the indicator is now invisible
1083   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1084
1085   // Set the duration to hide the indicator to be 0.65 second
1086   scrollBar.SetIndicatorHideDuration(0.65f);
1087   DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.65f, TEST_LOCATION );
1088
1089   // Make the indicator visible
1090   indicator.SetOpacity(1.0f);
1091
1092   // Render and notify
1093   application.SendNotification();
1094   application.Render();
1095
1096   // Check that the indicator is visible
1097   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1098
1099   // Hide the indicator
1100   scrollBar.HideIndicator();
1101
1102   // Wait for 0.15 second first
1103   Wait(application, 150);
1104
1105   // Render and notify
1106   application.SendNotification();
1107   application.Render();
1108
1109   // Check that the indicator is not fully invisible yet
1110   DALI_TEST_CHECK( indicator.GetCurrentOpacity() != 0.0f );
1111
1112   // Wait for another 0.5 second
1113   Wait(application, 500);
1114
1115   // Render and notify
1116   application.SendNotification();
1117   application.Render();
1118
1119   // Check that the indicator is now fully invisible
1120   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1121
1122   END_TEST;
1123 }
1124
1125 int UtcDaliToolkitScrollBarSetIndicatorHideDurationN(void)
1126 {
1127   ToolkitTestApplication application;
1128
1129   // Create a scroll bar
1130   ScrollBar scrollBar = ScrollBar::New();
1131   DALI_TEST_CHECK( scrollBar );
1132
1133   Stage::GetCurrent().Add( scrollBar );
1134
1135   Actor indicator = scrollBar.GetScrollIndicator();
1136   DALI_TEST_CHECK( indicator );
1137
1138   // Get the default duration to hide the indicator
1139   float duration = scrollBar.GetIndicatorHideDuration();
1140
1141   // Check that the default duration is greater than 0
1142   DALI_TEST_CHECK( duration > 0.0f );
1143
1144   // Make the indicator visible
1145   indicator.SetOpacity(1.0f);
1146
1147   // Render and notify
1148   application.SendNotification();
1149   application.Render();
1150
1151   // Check that the indicator is visible
1152   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1153
1154   // Hide the indicator
1155   scrollBar.HideIndicator();
1156
1157   // Wait for the specified duration
1158   Wait(application, duration * 1000);
1159
1160   // Render and notify
1161   application.SendNotification();
1162   application.Render();
1163
1164   // Check that the indicator is now invisible
1165   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1166
1167   // Now set the duration to hide the indicator to be a negative value (which should be ignored and therefore means instant)
1168   scrollBar.SetIndicatorHideDuration(-0.25f);
1169   DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), -0.25f, TEST_LOCATION );
1170
1171   // Make the indicator visible
1172   indicator.SetOpacity(1.0f);
1173
1174   // Render and notify
1175   application.SendNotification();
1176   application.Render();
1177
1178   // Check that the indicator is visible
1179   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1180
1181   // Hide the indicator
1182   scrollBar.HideIndicator();
1183
1184   // Render and notify
1185   application.SendNotification();
1186   application.Render();
1187
1188   // Check that the indicator becomes instantly invisible in the next frame
1189   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1190
1191   END_TEST;
1192 }
1193
1194 int UtcDaliToolkitScrollBarGetIndicatorHideDurationP(void)
1195 {
1196   ToolkitTestApplication application;
1197
1198   // Create a scroll bar
1199   ScrollBar scrollBar = ScrollBar::New();
1200   DALI_TEST_CHECK( scrollBar );
1201
1202   // Set the duration to hide the indicator to be 0.15 second
1203   scrollBar.SetIndicatorHideDuration(0.15f);
1204
1205   // Check that the duration to hide the indicator is 0.15 second
1206   DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.15f, TEST_LOCATION );
1207
1208   // Set the duration to hide the indicator to be 0.65 second
1209   scrollBar.SetIndicatorHideDuration(0.65f);
1210
1211   // Check that the duration to hide the indicator is 0.65 second
1212   DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.65f, TEST_LOCATION );
1213
1214   END_TEST;
1215 }
1216
1217 int UtcDaliToolkitScrollBarShowIndicatorP(void)
1218 {
1219   ToolkitTestApplication application;
1220
1221   // Create a scroll bar
1222   ScrollBar scrollBar = ScrollBar::New();
1223   DALI_TEST_CHECK( scrollBar );
1224
1225   Stage::GetCurrent().Add( scrollBar );
1226
1227   Actor indicator = scrollBar.GetScrollIndicator();
1228   DALI_TEST_CHECK( indicator );
1229
1230   // Get the default duration to show the indicator
1231   float duration = scrollBar.GetIndicatorShowDuration();
1232
1233   // Check that the default duration is greater than 0
1234   DALI_TEST_CHECK( duration > 0.0f );
1235
1236   // Make the indicator invisible
1237   indicator.SetOpacity(0.0f);
1238
1239   // Render and notify
1240   application.SendNotification();
1241   application.Render();
1242
1243   // Check that the indicator is invisible
1244   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1245
1246   // Show the indicator
1247   scrollBar.ShowIndicator();
1248
1249   // Wait for the specified duration
1250   Wait(application, duration * 1000);
1251
1252   // Render and notify
1253   application.SendNotification();
1254   application.Render();
1255
1256   // Check that the indicator is now visible
1257   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1258
1259   END_TEST;
1260 }
1261
1262 int UtcDaliToolkitScrollBarShowIndicatorN(void)
1263 {
1264   ToolkitTestApplication application;
1265
1266   // Create a scroll bar
1267   ScrollBar scrollBar = ScrollBar::New();
1268   DALI_TEST_CHECK( scrollBar );
1269
1270   Stage::GetCurrent().Add( scrollBar );
1271
1272   Actor indicator = scrollBar.GetScrollIndicator();
1273   DALI_TEST_CHECK( indicator );
1274
1275   // Make the indicator initially visible
1276   indicator.SetOpacity(1.0f);
1277
1278   // Render and notify
1279   application.SendNotification();
1280   application.Render();
1281
1282   // Check that the indicator is initially visible
1283   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1284
1285   // Get the default duration to show the indicator
1286   float duration = scrollBar.GetIndicatorShowDuration();
1287
1288   // Check that the default duration is greater than 0
1289   DALI_TEST_CHECK( duration > 0.0f );
1290
1291   // Show the indicator
1292   scrollBar.ShowIndicator();
1293
1294   // Render and notify
1295   application.SendNotification();
1296   application.Render();
1297
1298   // Check that the indicator is still visible in the very next frame
1299   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1300
1301   END_TEST;
1302 }
1303
1304 int UtcDaliToolkitScrollBarHideIndicatorP(void)
1305 {
1306   ToolkitTestApplication application;
1307
1308   // Create a scroll bar
1309   ScrollBar scrollBar = ScrollBar::New();
1310   DALI_TEST_CHECK( scrollBar );
1311
1312   Stage::GetCurrent().Add( scrollBar );
1313
1314   Actor indicator = scrollBar.GetScrollIndicator();
1315   DALI_TEST_CHECK( indicator );
1316
1317   // Get the default duration to hide the indicator
1318   float duration = scrollBar.GetIndicatorHideDuration();
1319
1320   // Check that the default duration is greater than 0
1321   DALI_TEST_CHECK( duration > 0.0f );
1322
1323   // Make the indicator visible
1324   indicator.SetOpacity(1.0f);
1325
1326   // Render and notify
1327   application.SendNotification();
1328   application.Render();
1329
1330   // Check that the indicator is visible
1331   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1332
1333   // Hide the indicator
1334   scrollBar.HideIndicator();
1335
1336   // Wait for the specified duration
1337   Wait(application, duration * 1000);
1338
1339   // Render and notify
1340   application.SendNotification();
1341   application.Render();
1342
1343   // Check that the indicator is now invisible
1344   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1345
1346   END_TEST;
1347 }
1348
1349 int UtcDaliToolkitScrollBarHideIndicatorN(void)
1350 {
1351   ToolkitTestApplication application;
1352
1353   // Create a scroll bar
1354   ScrollBar scrollBar = ScrollBar::New();
1355   DALI_TEST_CHECK( scrollBar );
1356
1357   Stage::GetCurrent().Add( scrollBar );
1358
1359   Actor indicator = scrollBar.GetScrollIndicator();
1360   DALI_TEST_CHECK( indicator );
1361
1362   // Make the indicator initially invisible
1363   indicator.SetOpacity(0.0f);
1364
1365   // Render and notify
1366   application.SendNotification();
1367   application.Render();
1368
1369   // Check that the indicator is initially invisible
1370   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1371
1372   // Get the default duration to hide the indicator
1373   float duration = scrollBar.GetIndicatorHideDuration();
1374
1375   // Check that the default duration is greater than 0
1376   DALI_TEST_CHECK( duration > 0.0f );
1377
1378   // Hide the indicator
1379   scrollBar.HideIndicator();
1380
1381   // Render and notify
1382   application.SendNotification();
1383   application.Render();
1384
1385   // Check that the indicator is still invisible in the very next frame
1386   DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1387
1388   END_TEST;
1389 }
1390
1391 int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
1392 {
1393   ToolkitTestApplication application;
1394
1395   // Create a vertical scroll bar
1396   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
1397   DALI_TEST_CHECK( scrollBar );
1398
1399   scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
1400   scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1401   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
1402
1403   // Set the indicator height to be fixed to 50.0f
1404   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
1405   scrollBar.SetIndicatorFixedHeight(50.0f);
1406
1407   Stage::GetCurrent().Add( scrollBar );
1408
1409   // Connect the pan finished signal
1410   ConnectionTracker connectionTracker;
1411   bool panFinished = false;
1412   scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
1413   scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
1414
1415   // Render and notify
1416   application.SendNotification();
1417   application.Render();
1418
1419   // Create a source actor that owns the scroll properties required by the scroll bar
1420   Actor sourceActor = Actor::New();
1421   Stage::GetCurrent().Add( sourceActor );
1422
1423   // Register the scroll properties
1424   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
1425   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
1426   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   100.0f );
1427   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   500.0f );
1428
1429   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
1430   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
1431   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
1432   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
1433
1434   // Set the source of the scroll position properties.
1435   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
1436
1437   // Render and notify
1438   application.SendNotification();
1439   application.Render();
1440
1441   // Perform a swipe gesture on the indicator
1442   PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
1443   DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
1444   DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
1445
1446   END_TEST;
1447 }
1448
1449 int UtcDaliToolkitScrollBarPanFinishedSignalN(void)
1450 {
1451   ToolkitTestApplication application;
1452
1453   // Create a vertical scroll bar
1454   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
1455   DALI_TEST_CHECK( scrollBar );
1456
1457   scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
1458   scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1459   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
1460
1461   // Set the indicator height to be fixed to 50.0f
1462   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
1463   scrollBar.SetIndicatorFixedHeight(50.0f);
1464
1465   Stage::GetCurrent().Add( scrollBar );
1466
1467   // Connect the pan finished signal
1468   ConnectionTracker connectionTracker;
1469   bool panFinished = false;
1470   scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
1471   scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
1472
1473   // Render and notify
1474   application.SendNotification();
1475   application.Render();
1476
1477   // Perform a vertical swipe gesture on the indicator when there is no source object set on the scroll bar
1478   PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
1479   DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
1480
1481   // Create a source actor that owns the scroll properties required by the scroll bar
1482   Actor sourceActor = Actor::New();
1483   Stage::GetCurrent().Add( sourceActor );
1484
1485   // Register the scroll properties
1486   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
1487   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
1488   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   100.0f );
1489   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   500.0f );
1490
1491   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
1492   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
1493   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
1494   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
1495
1496   // Set the source of the scroll position properties.
1497   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
1498
1499   // Render and notify
1500   application.SendNotification();
1501   application.Render();
1502
1503   // Perform a swipe gesture on the scroll bar but not on the indicator
1504   PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20);
1505   DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
1506   DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION );
1507
1508   // Perform a swipe gesture on the indicator
1509   PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
1510   DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
1511   DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
1512
1513   END_TEST;
1514 }
1515
1516 int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
1517 {
1518   ToolkitTestApplication application;
1519
1520   // Create a vertical scroll bar
1521   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
1522   DALI_TEST_CHECK( scrollBar );
1523
1524   scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
1525   scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1526   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
1527
1528   Stage::GetCurrent().Add( scrollBar );
1529   ConnectionTracker connectionTracker;
1530
1531   // Connect to the ScrollPositionIntervalReached signal
1532   bool intervalReached = false;
1533   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
1534   scrollBar.ConnectSignal( &connectionTracker, "scrollPositionIntervalReached", CallbackFunctor(&intervalReached));
1535
1536   // Render and notify
1537   application.SendNotification();
1538   application.Render();
1539
1540   // Create a source actor that owns the scroll properties required by the scroll bar
1541   Actor sourceActor = Actor::New();
1542   Stage::GetCurrent().Add( sourceActor );
1543
1544   // Register the scroll properties
1545   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
1546   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
1547   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   800.0f );
1548   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   2000.0f );
1549
1550   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
1551   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
1552   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
1553   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
1554
1555   // Set the source of the scroll position properties.
1556   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
1557
1558   // Render and notify
1559   application.SendNotification();
1560   application.Render();
1561
1562   // Set the values to get notified when the scroll positions of the source actor goes above or below these values
1563   Dali::Vector<float> positionIntervals;
1564   for( size_t i = 0; i != 10; ++i )
1565   {
1566     positionIntervals.PushBack( -80.0f * i ); // should get notified for each 80 pixels
1567   }
1568   scrollBar.SetScrollPositionIntervals(positionIntervals);
1569
1570   // Render and notify
1571   application.SendNotification();
1572   application.Render();
1573
1574   // Reset the flag
1575   gOnScrollPositionIntervalReachedSignalCalled = false;
1576
1577   // Animate the scroll position to cross the specified value
1578   Animation animation = Animation::New(0.1f);
1579   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -85.0f );
1580   animation.Play();
1581
1582   // Wait for 0.1 second
1583   Wait(application, 100);
1584
1585   // Check that the signal callback is called
1586   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
1587   DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
1588
1589   // Reset the flag
1590   gOnScrollPositionIntervalReachedSignalCalled = false;
1591   intervalReached = false;
1592
1593   // Rest and clear the animation
1594   animation.Clear();
1595   animation.Reset();
1596
1597   // Animate the scroll position to cross another specified value
1598   animation = Animation::New(0.1f);
1599   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -170.0f );
1600   animation.Play();
1601
1602   // Wait for 0.1 second
1603   Wait(application, 100);
1604
1605   // Check that the signal callback is called
1606   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
1607   DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
1608
1609   // Reset the flag
1610   gOnScrollPositionIntervalReachedSignalCalled = false;
1611   intervalReached = false;
1612
1613   // Rest and clear the animation
1614   animation.Clear();
1615   animation.Reset();
1616
1617   // Animate the scroll position back to the previous value
1618   animation = Animation::New(0.1f);
1619   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -85.0f );
1620   animation.Play();
1621
1622   // Wait for 0.1 second
1623   Wait(application, 100);
1624
1625   // Check that the signal callback is called
1626   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
1627   DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
1628
1629   END_TEST;
1630 }
1631
1632 int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void)
1633 {
1634   ToolkitTestApplication application;
1635
1636   // Create a vertical scroll bar
1637   ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical);
1638   DALI_TEST_CHECK( scrollBar );
1639
1640   scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
1641   scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1642   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
1643
1644   Stage::GetCurrent().Add( scrollBar );
1645
1646   // Connect to the ScrollPositionIntervalReached signal
1647   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
1648
1649   // Render and notify
1650   application.SendNotification();
1651   application.Render();
1652
1653   // Create a source actor that owns the scroll properties required by the scroll bar
1654   Actor sourceActor = Actor::New();
1655   Stage::GetCurrent().Add( sourceActor );
1656
1657   // Register the scroll properties
1658   Property::Index propertyScrollPosition = sourceActor.RegisterProperty( "sourcePosition",  0.0f );
1659   Property::Index propertyMinScrollPosition = sourceActor.RegisterProperty( "sourcePositionMin",   0.0f );
1660   Property::Index propertyMaxScrollPosition = sourceActor.RegisterProperty( "sourcePositionMax",   800.0f );
1661   Property::Index propertyScrollContentSize = sourceActor.RegisterProperty( "sourceContentSize",   2000.0f );
1662
1663   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePosition" ), propertyScrollPosition, TEST_LOCATION );
1664   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMin" ), propertyMinScrollPosition, TEST_LOCATION );
1665   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourcePositionMax" ), propertyMaxScrollPosition, TEST_LOCATION );
1666   DALI_TEST_EQUALS( sourceActor.GetPropertyIndex( "sourceContentSize" ), propertyScrollContentSize, TEST_LOCATION );
1667
1668   // Set the source of the scroll position properties.
1669   scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
1670
1671   // Render and notify
1672   application.SendNotification();
1673   application.Render();
1674
1675   // Set the values to get notified when the scroll positions of the source actor goes above or below these values
1676   Dali::Vector<float> positionIntervals;
1677   for( size_t i = 0; i != 10; ++i )
1678   {
1679     positionIntervals.PushBack( -80.0f * i ); // should get notified for each 80 pixels
1680   }
1681   scrollBar.SetScrollPositionIntervals(positionIntervals);
1682
1683   // Render and notify
1684   application.SendNotification();
1685   application.Render();
1686
1687   // Reset the flag
1688   gOnScrollPositionIntervalReachedSignalCalled = false;
1689
1690   // Animate the scroll position not to cross the specified value
1691   Animation animation = Animation::New(0.1f);
1692   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -70.0f );
1693   animation.Play();
1694
1695   // Wait for 0.1 second
1696   Wait(application, 100);
1697
1698   // Check that the signal callback is not called
1699   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, false, TEST_LOCATION );
1700
1701   // Rest and clear the animation
1702   animation.Clear();
1703   animation.Reset();
1704
1705   // Animate the scroll position to cross another specified value
1706   animation = Animation::New(0.1f);
1707   animation.AnimateTo( Property( sourceActor, propertyScrollPosition ), -85.0f );
1708   animation.Play();
1709
1710   // Wait for 0.1 second
1711   Wait(application, 100);
1712
1713   // Check that the signal callback is called
1714   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
1715
1716   END_TEST;
1717 }