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