namespace
{
-static bool gObjectCreatedCallBackCalled;
-
-static void TestCallback(BaseHandle handle)
-{
- gObjectCreatedCallBackCalled = true;
-}
const int MILLISECONDS_PER_SECOND = 1000;
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
-static bool gOnScrollClampedCalled; ///< Whether the OnScrollClamped signal was invoked.
-static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
-static ClampState3 gLastClampPosition; ///< Clamping information from OnScrollClampedEvent.
-static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
static Vector3 gConstraintResult; ///< Result from constraint.
static ActorContainer gPages; ///< Keeps track of all the pages for applying effects.
gOnScrollCompleteCalled = true;
}
-/**
- * Invoked when scrolling clamped.
- *
- * @param[in] event The position/scale/rotation axes that were clamped.
- */
-static void OnScrollClamped( const ScrollView::ClampEvent& event )
-{
- gOnScrollClampedCalled = true;
- gLastClampPosition = event.position;
-}
-
-/**
- * Invoked when a snap or flick started.
- *
- * @param[in] event The type of snap and the target position/scale/rotation.
- */
-static void OnSnapStart( const ScrollView::SnapEvent& event )
-{
- gOnSnapStartCalled = true;
- gLastSnapType = event.type;
-}
-
ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
{
ScrollView scrollView = ScrollView::New();
} // unnamed namespace
-int UtcDaliScrollViewCustomEffectSetup(void)
-{
- tet_infoline(" UtcDaliScrollViewCustomEffectSetup");
-
- ScrollViewCustomEffect effect;
-
- DALI_TEST_CHECK( !effect );
-
- BaseHandle handle = ScrollViewCustomEffect::New();
-
- DALI_TEST_CHECK( handle );
-
- effect = ScrollViewCustomEffect::DownCast(handle);
-
- DALI_TEST_CHECK( effect );
-
- END_TEST;
-}
-
int UtcDaliScrollViewCubeEffectSetup(void)
{
tet_infoline(" UtcDaliScrollViewCubeEffectSetup");
END_TEST;
}
-
-
-
-int UtcDaliScrollViewSlideEffectSetup(void)
-{
- tet_infoline(" UtcDaliScrollViewSlideEffectSetup");
-
- ScrollViewSlideEffect effect;
-
- DALI_TEST_CHECK( !effect );
-
- BaseHandle handle = ScrollViewSlideEffect::New();
-
- DALI_TEST_CHECK( handle );
-
- effect = ScrollViewSlideEffect::DownCast(handle);
-
- DALI_TEST_CHECK( effect );
- END_TEST;
-}
-
-int UtcDaliScrollViewTwistEffectSetup(void)
-{
- tet_infoline(" UtcDaliScrollViewTwistEffectSetup");
-
- ScrollViewTwistEffect effect;
-
- DALI_TEST_CHECK( !effect );
-
- BaseHandle handle = ScrollViewTwistEffect::New();
-
- DALI_TEST_CHECK( handle );
-
- effect = ScrollViewTwistEffect::DownCast(handle);
-
- DALI_TEST_CHECK( effect );
- END_TEST;
-}
-
int UtcDaliScrollViewCubeEffectTest(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliScrollViewPageCubeEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewPageCubeEffectSetup");
+
+ ScrollViewPageCubeEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewPageCubeEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewPageCubeEffect::DownCast(handle);
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
-int UtcDaliScrollViewSlideEffectTest(void)
+
+int UtcDaliScrollViewPageCarouselEffectSetup(void)
{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewSlideEffectTest");
+ tet_infoline(" UtcDaliScrollViewCarouselEffectSetup");
- Vector2 size = Stage::GetCurrent().GetSize();
- Vector3 pageSize(size.x, size.y, 0.0f);
+ ScrollViewPageCarouselEffect effect;
- ScrollView scrollView = SetupTestScrollView(1, 3, size);
- Actor testPage = gPages[1];
- Wait(application, 500);
+ DALI_TEST_CHECK( !effect );
- 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());
+ BaseHandle handle = ScrollViewPageCarouselEffect::New();
- scrollView.ApplyEffect(effect);
+ DALI_TEST_CHECK( handle );
- Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
- Wait(application);
- Vector3 actorPrePosition = actor.GetCurrentPosition();
+ effect = ScrollViewPageCarouselEffect::DownCast(handle);
- effect.ApplyToActor(actor, 0.0f, 0.5f);
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
- 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();
+int UtcDaliScrollViewCarouselEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewCarouselEffectSetup");
+
+ ScrollViewCarouselEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewCarouselEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewCarouselEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
END_TEST;
}
-int UtcDaliScrollViewTwistEffectTest(void)
+int UtcDaliScrollViewDepthEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewDepthEffectSetup");
+
+ ScrollViewDepthEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewDepthEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewDepthEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+
+int UtcDaliScrollViewPageCubeEffectTest(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewTwistEffectTest");
+ tet_infoline(" UtcDaliScrollViewPageCubeEffectTest");
Vector2 size = Stage::GetCurrent().GetSize();
Actor testPage = gPages[1];
Wait(application, 500);
- ScrollViewTwistEffect effect = ScrollViewTwistEffect::New();
- float shrinkDist = 0.2f;
- effect.SetMinimumDistanceForShrink(shrinkDist);
- DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0);
- effect.EnableEffect(true);
+ ScrollViewPageCubeEffect effect = ScrollViewPageCubeEffect::New();
scrollView.ApplyEffect(effect);
- Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
+ 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, Vector2(Math::PI_2, 0.0f));
+ }
Wait(application);
- Vector3 actorPrePosition = actor.GetCurrentPosition();
-
- effect.ApplyToActor( actor,
- true,
- Vector2(Math::PI_2, Math::PI_2),
- 0.0f);
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);
+ Vector3 pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
CleanupTest();
END_TEST;
}
-int UtcDaliScrollViewCustomEffectTest(void)
+int UtcDaliScrollViewPageCarouselEffectTest(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewCustomEffectTest");
+ tet_infoline(" UtcDaliScrollViewPageCarouselEffectTest");
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));
+ ScrollViewPageCarouselEffect effect = ScrollViewPageCarouselEffect::New();
+ 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);
+ effect.ApplyToPage(page);
}
Wait(application);
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- scrollView.ScrollTo(1);
+ scrollView.ScrollTo(1, 0.5f, DirectionBiasNone);
while(!gOnScrollCompleteCalled)
{
Wait(application);
}
- ResetScrollCallbackResults();
// test that the first page has reached centre of screen
- pagePos = testPage.GetCurrentPosition();
+ Vector3 pagePos = testPage.GetCurrentPosition();
DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ CleanupTest();
+ END_TEST;
+}
- // 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));
+int UtcDaliScrollViewCarouselEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewCarouselEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewCarouselEffect effect = ScrollViewCarouselEffect::New();
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);
- }
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
Wait(application);
- pagePos = testPage.GetCurrentPosition();
- DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
- scrollView.ScrollTo(1);
+ effect.ApplyToActor( actor, Vector2(1.2f, 1.2f) );
+
+ scrollView.ScrollTo(Vector3(size.x, 0.0f, 0.0f), 0.5f, DirectionBiasNone, DirectionBiasNone);
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);
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
- // 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);
+int UtcDaliScrollViewDepthEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewDepthEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewDepthEffect effect = ScrollViewDepthEffect::New();
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);
- }
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ const Vector2 positionExtent(0.5f, 2.5f);
+ const Vector2 offsetExtent(1.0f, 1.0f);
+ const float positionScale(1.5f);
+ const float scaleExtent(0.5f);
+
+ effect.ApplyToActor( actor, positionExtent, offsetExtent, positionScale, scaleExtent );
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.SetPageTranslateAlphaFunction(AlphaFunctions::Linear);
- effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
- effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear);
- effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear);
- effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS);
- effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f));
- effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
- effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS);
- effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS);
- effect.SetGlobalPageRotationOrigin(Vector3::ZERO);
- effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO);
- effect.SetGlobalPageRotationOriginIn(Vector3::ZERO);
- effect.SetGlobalPageRotationOriginOut(Vector3::ZERO);
- effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
- effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
- effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS);
- effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS);
- effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear);
- effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
- effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear);
- effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear);
- effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT);
- effect.SetSwingAnchorIn(AnchorPoint::CENTER);
- effect.SetSwingAnchorOut(AnchorPoint::CENTER);
- effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear);
- effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
- effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear);
- effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear);
- effect.SetOpacityThreshold(0.5f);
- effect.SetOpacityThreshold(0.5f, 0.5f);
- effect.SetOpacityThresholdIn(0.5f);
- effect.SetOpacityThresholdOut(0.5f);
- effect.SetOpacityAlphaFunction(AlphaFunctions::Linear);
- effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
- effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear);
- effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear);
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
CleanupTest();
END_TEST;
}