- ScrollViewSlideEffect effect = ScrollViewSlideEffect::New();
- effect.SetDelayReferenceOffset(pageSize * 0.25);
- DALI_TEST_EQUALS(effect.GetDelayReferenceOffset(), pageSize * 0.25, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- effect.SetMaxDelayDuration(0.5f);
- DALI_TEST_EQUALS(effect.GetMaxDelayDuration(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- effect.SetSlideDirection(false);
- DALI_TEST_CHECK(!effect.GetSlideDirection());
-
- scrollView.ApplyEffect(effect);
-
- Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
- Wait(application);
- Vector3 actorPrePosition = actor.GetCurrentPosition();
-
- effect.ApplyToActor(actor, 0.0f, 0.5f);
-
- scrollView.ScrollTo(1);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- // test that the first page has reached centre of screen
- Vector3 actorPostPosition = actor.GetCurrentPosition();
- // just check the actor has moved
- DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
- CleanupTest();
- END_TEST;
-}
-
-int UtcDaliScrollViewCustomEffectTest(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewCustomEffectTest");
-
- Vector2 size = Stage::GetCurrent().GetSize();
- Vector3 pageSize(size.x, size.y, 0.0f);
-
- ScrollView scrollView = SetupTestScrollView(1, 3, size);
- Actor testPage = gPages[1];
- Wait(application, 500);
- Vector3 pageStartPos, pagePos;
- pageStartPos = pagePos = testPage.GetCurrentPosition();
- //scrollView.RemoveConstraintsFromChildren();
-
- ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel));
-
- for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
- {
- Actor page = *pageIter;
- page.RemoveConstraints();
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
- effect.ApplyToPage(page, pageSize);
- }
- Wait(application);
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- scrollView.ScrollTo(1);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- ResetScrollCallbackResults();
- // test that the first page has reached centre of screen
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- // scroll back to page 0
- scrollView.ScrollTo(0);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- ResetScrollCallbackResults();
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- scrollView.RemoveEffect(effect);
-
- effect = ScrollViewCustomEffect::New();
- effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f));
- effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f), Vector3(20.0f, 20.0f, -5.0f));
- effect.SetPageTranslationIn(Vector3(20.0f, 20.0f, 5.0f));
- effect.SetPageTranslationOut(Vector3(20.0f, 20.0f, -5.0f));
- effect.SetPageTranslation(Vector3(20.0f, 0.0f, 0.0f));
- effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
- effect.SetPageSpacing(Vector2(20.0f, 20.0f));
- scrollView.ApplyEffect(effect);
-
- for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
- {
- Actor page = *pageIter;
- page.RemoveConstraints();
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
- effect.ApplyToPage(page, pageSize);
- }
- Wait(application);
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- scrollView.ScrollTo(1);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- ResetScrollCallbackResults();
- // test that the first page has reached centre of screen
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- // scroll back to page 0
- scrollView.ScrollTo(0);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- ResetScrollCallbackResults();
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
-
- scrollView.RemoveEffect(effect);
- effect = ScrollViewCustomEffect::New();
- effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
- effect.SetSwingAnchor(AnchorPoint::CENTER_LEFT);
- effect.SetPageTranslation(Vector3(size.x, size.y, 0));
- effect.SetOpacityThreshold(0.66f);
- scrollView.ApplyEffect(effect);
-
- for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
- {
- Actor page = *pageIter;
- page.RemoveConstraints();
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
- effect.ApplyToPage(page, pageSize);
- }
- Wait(application);
-
- scrollView.ScrollTo(1);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- ResetScrollCallbackResults();
- // test that the first page has reached centre of screen
- pagePos = testPage.GetCurrentPosition();