(StyleManager) Add style monitor signal into StyleManager
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ScrollViewEffect.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 #include <iostream>
18 #include <stdlib.h>
19
20 // Need to override adaptor classes for toolkit test harness, so include
21 // test harness headers before dali headers.
22 #include <dali-toolkit-test-suite-utils.h>
23
24 #include <dali.h>
25 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali/integration-api/events/touch-event-integ.h>
27 #include <dali/integration-api/events/pan-gesture-event.h>
28
29 using namespace Dali;
30 using namespace Toolkit;
31
32 void utc_dali_toolkit_scroll_view_effect_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void utc_dali_toolkit_scroll_view_effect_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 namespace
43 {
44 static bool gObjectCreatedCallBackCalled;
45
46 static void TestCallback(BaseHandle handle)
47 {
48   gObjectCreatedCallBackCalled = true;
49 }
50
51 const int MILLISECONDS_PER_SECOND = 1000;
52 const int RENDER_FRAME_INTERVAL = 16;                           ///< Duration of each frame in ms. (at approx 60FPS)
53 const int RENDER_ANIMATION_TEST_DURATION_MS = 1000;             ///< 1000ms to test animation
54 const int RENDER_DELAY_SCROLL = 1000;                           ///< duration to wait for any scroll to complete.
55
56 /*
57  * Simulate time passed by.
58  *
59  * @note this will always process at least 1 frame (1/60 sec)
60  *
61  * @param application Test application instance
62  * @param duration Time to pass in milliseconds.
63  * @return The actual time passed in milliseconds
64  */
65 int Wait(ToolkitTestApplication& application, int duration = 0)
66 {
67   int time = 0;
68
69   for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
70   {
71     application.SendNotification();
72     application.Render(RENDER_FRAME_INTERVAL);
73     time += RENDER_FRAME_INTERVAL;
74   }
75
76   return time;
77 }
78
79 /**
80  * Creates a Ruler that snaps to a specified grid size.
81  * If that grid size is 0.0 then this ruler does not
82  * snap.
83  *
84  * @param[in] gridSize (optional) The grid size for the ruler,
85  * (Default = 0.0 i.e. no snapping)
86  * @return The ruler is returned.
87  */
88 RulerPtr CreateRuler(float gridSize = 0.0f)
89 {
90   if(gridSize <= Math::MACHINE_EPSILON_0)
91   {
92       return new DefaultRuler();
93   }
94   return new FixedRuler(gridSize);
95 }
96
97 // Callback probes.
98
99 static bool gOnScrollStartCalled;                       ///< Whether the OnScrollStart signal was invoked.
100 static bool gOnScrollUpdateCalled;                      ///< Whether the OnScrollUpdate signal was invoked.
101 static bool gOnScrollCompleteCalled;                    ///< Whether the OnScrollComplete signal was invoked.
102 static bool gOnScrollClampedCalled;                     ///< Whether the OnScrollClamped signal was invoked.
103 static bool gOnSnapStartCalled;                         ///< Whether the OnSnapStart signal was invoked.
104 static ClampState3 gLastClampPosition;                  ///< Clamping information from OnScrollClampedEvent.
105 static SnapType gLastSnapType;                          ///< Snaping information from SnapEvent.
106 static Vector3 gConstraintResult;                       ///< Result from constraint.
107
108 static ActorContainer gPages;                                ///< Keeps track of all the pages for applying effects.
109
110 static void ResetScrollCallbackResults()
111 {
112   gOnScrollStartCalled = false;
113   gOnScrollUpdateCalled = false;
114   gOnScrollCompleteCalled = false;
115 }
116
117 /**
118  * Invoked when scrolling starts.
119  *
120  * @param[in] position The current scroll position.
121  */
122 static void OnScrollStart( const Vector3& position )
123 {
124   gOnScrollStartCalled = true;
125 }
126
127 /**
128  * Invoked when scrolling updates (via dragging)
129  *
130  * @param[in] position The current scroll position.
131  */
132 static void OnScrollUpdate( const Vector3& position )
133 {
134   gOnScrollUpdateCalled = true;
135 }
136
137 /**
138  * Invoked when scrolling finishes
139  *
140  * @param[in] position The current scroll position.
141  */
142 static void OnScrollComplete( const Vector3& position )
143 {
144   gOnScrollCompleteCalled = true;
145 }
146
147 /**
148  * Invoked when scrolling clamped.
149  *
150  * @param[in] event The position/scale/rotation axes that were clamped.
151  */
152 static void OnScrollClamped( const ScrollView::ClampEvent& event )
153 {
154   gOnScrollClampedCalled = true;
155   gLastClampPosition = event.position;
156 }
157
158 /**
159  * Invoked when a snap or flick started.
160  *
161  * @param[in] event The type of snap and the target position/scale/rotation.
162  */
163 static void OnSnapStart( const ScrollView::SnapEvent& event )
164 {
165   gOnSnapStartCalled = true;
166   gLastSnapType = event.type;
167 }
168
169 ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
170 {
171   ScrollView scrollView = ScrollView::New();
172   scrollView.SetSize(size);
173   scrollView.SetAnchorPoint(AnchorPoint::CENTER);
174   scrollView.SetParentOrigin(ParentOrigin::CENTER);
175   scrollView.ApplyConstraint( Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) );
176   // Disable Refresh signal (TET environment cannot use adaptor's Timer)
177   scrollView.SetWrapMode(false);
178   scrollView.SetRefreshInterval(0);
179   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
180   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
181   scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
182   Stage::GetCurrent().Add( scrollView );
183   RulerPtr rulerX = CreateRuler(size.width);
184   RulerPtr rulerY = CreateRuler(size.height);
185   if(columns > 1)
186   {
187     rulerX->SetDomain(RulerDomain(0.0f, size.width * columns));
188   }
189   else
190   {
191     rulerX->Disable();
192   }
193   if(rows > 1)
194   {
195     rulerY->SetDomain(RulerDomain(0.0f, size.width * rows));
196   }
197   else
198   {
199     rulerY->Disable();
200   }
201
202   scrollView.SetRulerX( rulerX );
203   scrollView.SetRulerY( rulerY );
204   Stage::GetCurrent().Add( scrollView );
205
206   Actor container = Actor::New();
207   container.SetParentOrigin(ParentOrigin::CENTER);
208   container.SetAnchorPoint(AnchorPoint::CENTER);
209   container.SetSize( size );
210   scrollView.Add( container );
211   container.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
212
213   gPages.clear();
214   for(int row = 0;row<rows;row++)
215   {
216     for(int column = 0;column<columns;column++)
217     {
218       Actor page = Actor::New();
219       page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
220       page.SetParentOrigin( ParentOrigin::CENTER );
221       page.SetAnchorPoint( AnchorPoint::CENTER );
222       page.SetPosition( column * size.x, row * size.y );
223       container.Add(page);
224
225       gPages.push_back(page);
226     }
227   }
228
229   ResetScrollCallbackResults();
230   return scrollView;
231 }
232
233 void CleanupTest()
234 {
235   gPages.clear();
236   ResetScrollCallbackResults();
237 }
238
239 Actor AddActorToPage(Actor page, float x, float y, float cols, float rows)
240 {
241   Stage stage = Stage::GetCurrent();
242   Vector2 stageSize = stage.GetSize();
243
244   const float margin = 10.0f;
245   const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin);
246
247   Actor actor = Actor::New();
248   actor.SetParentOrigin( ParentOrigin::CENTER );
249   actor.SetAnchorPoint( AnchorPoint::CENTER );
250
251   Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f,
252                     margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f,
253                     0.0f);
254   Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin,
255                        margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin,
256                        0.0f);
257   Vector3 size(positionEnd - position);
258   actor.SetPosition( position + size * 0.5f);
259   actor.SetSize( positionEnd - position );
260   page.Add(actor);
261   return actor;
262 }
263
264 } // unnamed namespace
265
266
267 int UtcDaliScrollViewCustomEffectSetup(void)
268 {
269   tet_infoline(" UtcDaliScrollViewCustomEffectSetup");
270
271   ScrollViewCustomEffect effect;
272
273   DALI_TEST_CHECK( !effect );
274
275   BaseHandle handle = ScrollViewCustomEffect::New();
276
277   DALI_TEST_CHECK( handle );
278
279   effect = ScrollViewCustomEffect::DownCast(handle);
280
281   DALI_TEST_CHECK( effect );
282
283   END_TEST;
284 }
285
286 int UtcDaliScrollViewCubeEffectSetup(void)
287 {
288   tet_infoline(" UtcDaliScrollViewCubeEffectSetup");
289
290   ScrollViewCubeEffect effect;
291
292   DALI_TEST_CHECK( !effect );
293
294   BaseHandle handle = ScrollViewCubeEffect::New();
295
296   DALI_TEST_CHECK( handle );
297
298   effect = ScrollViewCubeEffect::DownCast(handle);
299
300   DALI_TEST_CHECK( effect );
301   END_TEST;
302 }
303
304 int UtcDaliScrollViewSpiralEffectSetup(void)
305 {
306   tet_infoline(" UtcDaliScrollViewSpiralEffectSetup");
307
308   ScrollViewPageSpiralEffect effect;
309
310   DALI_TEST_CHECK( !effect );
311
312   BaseHandle handle = ScrollViewPageSpiralEffect::New();
313
314   DALI_TEST_CHECK( handle );
315
316   effect = ScrollViewPageSpiralEffect::DownCast(handle);
317
318   DALI_TEST_CHECK( effect );
319   END_TEST;
320 }
321
322
323
324
325 int UtcDaliScrollViewSlideEffectSetup(void)
326 {
327   tet_infoline(" UtcDaliScrollViewSlideEffectSetup");
328
329   ScrollViewSlideEffect effect;
330
331   DALI_TEST_CHECK( !effect );
332
333   BaseHandle handle = ScrollViewSlideEffect::New();
334
335   DALI_TEST_CHECK( handle );
336
337   effect = ScrollViewSlideEffect::DownCast(handle);
338
339   DALI_TEST_CHECK( effect );
340   END_TEST;
341 }
342
343 int UtcDaliScrollViewTwistEffectSetup(void)
344 {
345   tet_infoline(" UtcDaliScrollViewTwistEffectSetup");
346
347   ScrollViewTwistEffect effect;
348
349   DALI_TEST_CHECK( !effect );
350
351   BaseHandle handle = ScrollViewTwistEffect::New();
352
353   DALI_TEST_CHECK( handle );
354
355   effect = ScrollViewTwistEffect::DownCast(handle);
356
357   DALI_TEST_CHECK( effect );
358   END_TEST;
359 }
360
361 int UtcDaliScrollViewCubeEffectTest(void)
362 {
363   ToolkitTestApplication application;
364   tet_infoline(" UtcDaliScrollViewCubeEffectTest");
365
366   Vector2 size = Stage::GetCurrent().GetSize();
367
368   ScrollView scrollView = SetupTestScrollView(1, 3, size);
369   Actor page = gPages[1];
370   Wait(application, 500);
371
372   ScrollViewCubeEffect effect = ScrollViewCubeEffect::New();
373   scrollView.ApplyEffect(effect);
374
375   Actor actor = AddActorToPage(page, 0.5f, 0.5f, 3, 3);
376   Wait(application);
377   Vector3 actorPrePosition = actor.GetCurrentPosition();
378
379   effect.ApplyToActor(actor, page, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size);
380
381   Actor actor2 = AddActorToPage(page, 0.5f, 0.5f, 3, 3);
382   effect.ApplyToActor(actor2, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size);
383
384   scrollView.ScrollTo(1);
385   while(!gOnScrollCompleteCalled)
386   {
387     Wait(application);
388   }
389   // test that the first page has reached centre of screen
390   Vector3 actorPostPosition = actor.GetCurrentPosition();
391   // just check the actor has moved
392   DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
393   CleanupTest();
394   END_TEST;
395 }
396
397
398 int UtcDaliScrollViewSpiralEffectTest(void)
399 {
400   ToolkitTestApplication application;
401   tet_infoline(" UtcDaliScrollViewSpiralEffectTest");
402
403   Vector2 size = Stage::GetCurrent().GetSize();
404
405   ScrollView scrollView = SetupTestScrollView(1, 3, size);
406   Actor testPage = gPages[1];
407   Wait(application, 500);
408
409   ScrollViewPageSpiralEffect effect = ScrollViewPageSpiralEffect::New();
410   scrollView.ApplyEffect(effect);
411
412   for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
413   {
414     Actor page = *pageIter;
415     page.RemoveConstraints();
416     page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
417     effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f));
418   }
419   Wait(application);
420
421   scrollView.ScrollTo(1);
422   while(!gOnScrollCompleteCalled)
423   {
424     Wait(application);
425   }
426   // test that the first page has reached centre of screen
427   Vector3 pagePos = testPage.GetCurrentPosition();
428   DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
429   CleanupTest();
430   END_TEST;
431 }
432
433
434
435 int UtcDaliScrollViewSlideEffectTest(void)
436 {
437   ToolkitTestApplication application;
438   tet_infoline(" UtcDaliScrollViewSlideEffectTest");
439
440   Vector2 size = Stage::GetCurrent().GetSize();
441   Vector3 pageSize(size.x, size.y, 0.0f);
442
443   ScrollView scrollView = SetupTestScrollView(1, 3, size);
444   Actor testPage = gPages[1];
445   Wait(application, 500);
446
447   ScrollViewSlideEffect effect = ScrollViewSlideEffect::New();
448   effect.SetDelayReferenceOffset(pageSize * 0.25);
449   DALI_TEST_EQUALS(effect.GetDelayReferenceOffset(), pageSize * 0.25, Math::MACHINE_EPSILON_0, TEST_LOCATION);
450   effect.SetMaxDelayDuration(0.5f);
451   DALI_TEST_EQUALS(effect.GetMaxDelayDuration(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
452   effect.SetSlideDirection(false);
453   DALI_TEST_CHECK(!effect.GetSlideDirection());
454
455   scrollView.ApplyEffect(effect);
456
457   Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
458   Wait(application);
459   Vector3 actorPrePosition = actor.GetCurrentPosition();
460
461   effect.ApplyToActor(actor, 0.0f, 0.5f);
462
463   scrollView.ScrollTo(1);
464   while(!gOnScrollCompleteCalled)
465   {
466     Wait(application);
467   }
468   // test that the first page has reached centre of screen
469   Vector3 actorPostPosition = actor.GetCurrentPosition();
470   // just check the actor has moved
471   DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
472   CleanupTest();
473   END_TEST;
474 }
475
476 int UtcDaliScrollViewTwistEffectTest(void)
477 {
478   ToolkitTestApplication application;
479   tet_infoline(" UtcDaliScrollViewTwistEffectTest");
480
481   Vector2 size = Stage::GetCurrent().GetSize();
482
483   ScrollView scrollView = SetupTestScrollView(1, 3, size);
484   Actor testPage = gPages[1];
485   Wait(application, 500);
486
487   ScrollViewTwistEffect effect = ScrollViewTwistEffect::New();
488   float shrinkDist = 0.2f;
489   effect.SetMinimumDistanceForShrink(shrinkDist);
490   DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0);
491   effect.EnableEffect(true);
492   scrollView.ApplyEffect(effect);
493
494   Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
495   Wait(application);
496   Vector3 actorPrePosition = actor.GetCurrentPosition();
497
498   effect.ApplyToActor( actor,
499       true,
500       Vector2(Math::PI_2, Math::PI_2),
501       0.0f);
502
503   scrollView.ScrollTo(1);
504   while(!gOnScrollCompleteCalled)
505   {
506     Wait(application);
507   }
508   // test that the first page has reached centre of screen
509   Vector3 actorPostPosition = actor.GetCurrentPosition();
510   // just check the actor has moved
511   DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
512   CleanupTest();
513   END_TEST;
514 }
515
516 int UtcDaliScrollViewCustomEffectTest(void)
517 {
518   ToolkitTestApplication application;
519   tet_infoline(" UtcDaliScrollViewCustomEffectTest");
520
521   Vector2 size = Stage::GetCurrent().GetSize();
522   Vector3 pageSize(size.x, size.y, 0.0f);
523
524   ScrollView scrollView = SetupTestScrollView(1, 3, size);
525   Actor testPage = gPages[1];
526   Wait(application, 500);
527   Vector3 pageStartPos, pagePos;
528   pageStartPos = pagePos = testPage.GetCurrentPosition();
529   //scrollView.RemoveConstraintsFromChildren();
530
531   ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel));
532
533   for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
534   {
535     Actor page = *pageIter;
536     page.RemoveConstraints();
537     page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
538     effect.ApplyToPage(page, pageSize);
539   }
540   Wait(application);
541   pagePos = testPage.GetCurrentPosition();
542   DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
543
544   scrollView.ScrollTo(1);
545   while(!gOnScrollCompleteCalled)
546   {
547     Wait(application);
548   }
549   ResetScrollCallbackResults();
550   // test that the first page has reached centre of screen
551   pagePos = testPage.GetCurrentPosition();
552   DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
553
554   // scroll back to page 0
555   scrollView.ScrollTo(0);
556   while(!gOnScrollCompleteCalled)
557   {
558     Wait(application);
559   }
560   ResetScrollCallbackResults();
561   pagePos = testPage.GetCurrentPosition();
562   DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
563
564   scrollView.RemoveEffect(effect);
565
566   effect = ScrollViewCustomEffect::New();
567   effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f));
568   effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f), Vector3(20.0f, 20.0f, -5.0f));
569   effect.SetPageTranslationIn(Vector3(20.0f, 20.0f, 5.0f));
570   effect.SetPageTranslationOut(Vector3(20.0f, 20.0f, -5.0f));
571   effect.SetPageTranslation(Vector3(20.0f, 0.0f, 0.0f));
572   effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
573   effect.SetPageSpacing(Vector2(20.0f, 20.0f));
574   scrollView.ApplyEffect(effect);
575
576   for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
577   {
578     Actor page = *pageIter;
579     page.RemoveConstraints();
580     page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
581     effect.ApplyToPage(page, pageSize);
582   }
583   Wait(application);
584   pagePos = testPage.GetCurrentPosition();
585   DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
586
587   scrollView.ScrollTo(1);
588   while(!gOnScrollCompleteCalled)
589   {
590     Wait(application);
591   }
592   ResetScrollCallbackResults();
593   // test that the first page has reached centre of screen
594   pagePos = testPage.GetCurrentPosition();
595   DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
596
597   // scroll back to page 0
598   scrollView.ScrollTo(0);
599   while(!gOnScrollCompleteCalled)
600   {
601     Wait(application);
602   }
603   ResetScrollCallbackResults();
604   pagePos = testPage.GetCurrentPosition();
605   DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
606
607   scrollView.RemoveEffect(effect);
608   effect = ScrollViewCustomEffect::New();
609   effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
610   effect.SetSwingAnchor(AnchorPoint::CENTER_LEFT);
611   effect.SetPageTranslation(Vector3(size.x, size.y, 0));
612   effect.SetOpacityThreshold(0.66f);
613   scrollView.ApplyEffect(effect);
614
615   for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
616   {
617     Actor page = *pageIter;
618     page.RemoveConstraints();
619     page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
620     effect.ApplyToPage(page, pageSize);
621   }
622   Wait(application);
623
624   scrollView.ScrollTo(1);
625   while(!gOnScrollCompleteCalled)
626   {
627     Wait(application);
628   }
629   ResetScrollCallbackResults();
630   // test that the first page has reached centre of screen
631   pagePos = testPage.GetCurrentPosition();
632   DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
633
634   // scroll back to page 0
635   scrollView.ScrollTo(0);
636   while(!gOnScrollCompleteCalled)
637   {
638     Wait(application);
639   }
640   ResetScrollCallbackResults();
641   pagePos = testPage.GetCurrentPosition();
642   DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
643   scrollView.RemoveEffect(effect);
644
645
646   effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear);
647   effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
648   effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear);
649   effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear);
650   effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS);
651   effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f));
652   effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
653   effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS);
654   effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS);
655   effect.SetGlobalPageRotationOrigin(Vector3::ZERO);
656   effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO);
657   effect.SetGlobalPageRotationOriginIn(Vector3::ZERO);
658   effect.SetGlobalPageRotationOriginOut(Vector3::ZERO);
659   effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
660   effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
661   effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS);
662   effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS);
663   effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear);
664   effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
665   effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear);
666   effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear);
667   effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT);
668   effect.SetSwingAnchorIn(AnchorPoint::CENTER);
669   effect.SetSwingAnchorOut(AnchorPoint::CENTER);
670   effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear);
671   effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
672   effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear);
673   effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear);
674   effect.SetOpacityThreshold(0.5f);
675   effect.SetOpacityThreshold(0.5f, 0.5f);
676   effect.SetOpacityThresholdIn(0.5f);
677   effect.SetOpacityThresholdOut(0.5f);
678   effect.SetOpacityAlphaFunction(AlphaFunctions::Linear);
679   effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
680   effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear);
681   effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear);
682   CleanupTest();
683   END_TEST;
684 }