X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ScrollViewEffect.cpp;h=a527eacb523c609121195bd55c12dfaf5297bed2;hp=d7edf064720fc8e04e052725e152ec5c33340187;hb=5e351965bad7e1de2e94027548b022bac692603c;hpb=df89f9f230cadaac7be4007d1b1a7cf7dc893011 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp index d7edf06..a527eac 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,10 +43,7 @@ void utc_dali_toolkit_scroll_view_effect_cleanup(void) namespace { -const int MILLISECONDS_PER_SECOND = 1000; const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) -const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation -const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete. /* * Simulate time passed by. @@ -216,196 +213,8 @@ void CleanupTest() ResetScrollCallbackResults(); } -Actor AddActorToPage(Actor page, float x, float y, float cols, float rows) -{ - Stage stage = Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); - - const float margin = 10.0f; - const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin); - - Actor actor = Actor::New(); - actor.SetParentOrigin( ParentOrigin::CENTER ); - actor.SetAnchorPoint( AnchorPoint::CENTER ); - - Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f, - margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f, - 0.0f); - Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin, - margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin, - 0.0f); - Vector3 size(positionEnd - position); - actor.SetPosition( position + size * 0.5f); - actor.SetSize( positionEnd - position ); - page.Add(actor); - return actor; -} - } // unnamed namespace - -int UtcDaliScrollViewCubeEffectSetup(void) -{ - tet_infoline(" UtcDaliScrollViewCubeEffectSetup"); - - ScrollViewCubeEffect effect; - - DALI_TEST_CHECK( !effect ); - - BaseHandle handle = ScrollViewCubeEffect::New(); - - DALI_TEST_CHECK( handle ); - - effect = ScrollViewCubeEffect::DownCast(handle); - - DALI_TEST_CHECK( effect ); - END_TEST; -} - -int UtcDaliScrollViewCubeEffectTest(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewCubeEffectTest"); - - Vector2 size = Stage::GetCurrent().GetSize(); - - ScrollView scrollView = SetupTestScrollView(1, 3, size); - Actor page = gPages[1]; - Wait(application, 500); - - ScrollViewCubeEffect effect = ScrollViewCubeEffect::New(); - scrollView.ApplyEffect(effect); - - Actor actor = AddActorToPage(page, 0.5f, 0.5f, 3, 3); - Wait(application); - Vector3 actorPrePosition = actor.GetCurrentPosition(); - - 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); - - Actor actor2 = AddActorToPage(page, 0.5f, 0.5f, 3, 3); - 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); - - 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 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 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); - - Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); - Wait(application); - Vector3 actorPrePosition = actor.GetCurrentPosition(); - - effect.ApplyToActor( actor, Vector2(1.2f, 1.2f) ); - - scrollView.ScrollTo(Vector2(size.x, 0.0f), 0.5f, DirectionBiasNone, DirectionBiasNone); - 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 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 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); - - 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); - } - // 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 UtcDaliScrollViewPagePathEffectSetup(void) { tet_infoline(" UtcDaliScrollViewPagePathEffectSetup"); @@ -440,14 +249,14 @@ int UtcDaliScrollViewPagePathEffectTest(void) Dali::Path path = Dali::Path::New(); Dali::Property::Array points; - points.resize(3); + points.Resize(3); points[0] = Vector3( xHalfSize, 0.0f, -xHalfSize); points[1] = Vector3( 0.0f, 0.0f, 0.0f ); points[2] = Vector3( -xHalfSize, 0.0f, -xHalfSize); path.SetProperty( Path::Property::POINTS, points ); Dali::Property::Array controlPoints; - controlPoints.resize(4); + controlPoints.Resize(4); controlPoints[0] = Vector3( xHalfSize, 0.0f, 0.0f ); controlPoints[1] = Vector3( xHalfSize, 0.0f, 0.0f ); controlPoints[2] = Vector3(-xHalfSize, 0.0f, 0.0f ); @@ -486,4 +295,3 @@ int UtcDaliScrollViewPagePathEffectTest(void) CleanupTest(); END_TEST; } -