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-ScrollView.cpp;h=99613a508659d5b5baf3fff63ab7d51657281e5c;hp=fd01efe3f6812bb17e4ab97aa0afd01985469191;hb=5e351965bad7e1de2e94027548b022bac692603c;hpb=7a24e2759c8627d8b77e1472d207739ab5677ebe diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index fd01efe..99613a5 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 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. @@ -44,10 +44,24 @@ static void TestCallback(BaseHandle handle) gObjectCreatedCallBackCalled = true; } +struct CallbackFunctor +{ + CallbackFunctor(bool* callbackFlag) + : mCallbackFlag( callbackFlag ) + { + } + + void operator()() + { + *mCallbackFlag = true; + } + bool* mCallbackFlag; +}; 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. // For Clamp Signal testing... @@ -235,8 +249,8 @@ static float TestOvershootSnapDuration(ToolkitTestApplication &application, Scro int timeToReachOrigin = -1; for(int i = 0;i(ScrollView::Property::OVERSHOOT_X); - float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + float overshootXValue = scrollView.GetCurrentProperty( ScrollView::Property::OVERSHOOT_X ); + float overshootYValue = scrollView.GetCurrentProperty( ScrollView::Property::OVERSHOOT_Y ); if(overshootXValue == 0.0f && overshootYValue == 0.0f) { break; @@ -262,6 +276,37 @@ float TestAlphaFunction(float progress) return std::min( progress * 2.0f, 1.0f ); } +static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true) +{ + gOnScrollStartCalled = false; + gOnScrollUpdateCalled = false; + gOnScrollCompleteCalled = false; + gOnSnapStartCalled = false; + + // Now do a pan starting from (start) and heading (direction) + Vector2 pos(start); + SendPan(application, Gesture::Possible, pos); + SendPan(application, Gesture::Started, pos); + Wait(application); + + for(int i = 0;i(), true, TEST_LOCATION ); + const Vector2 target = Vector2(50.0f, 50.0f); const Vector2 target2 = Vector2(150.0f, 150.0f); @@ -403,7 +470,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void) scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft ); Wait(application, RENDER_DELAY_SCROLL); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); scrollView.ScrollTo( target, 0.0f ); Wait(application, RENDER_DELAY_SCROLL); @@ -472,7 +539,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(v scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft ); Wait(application, RENDER_DELAY_SCROLL); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); scrollView.ScrollTo( target, 0.0f ); Wait(application, RENDER_DELAY_SCROLL); @@ -554,6 +621,215 @@ int UtcDaliToolkitScrollViewScrollToPageP(void) END_TEST; } + +int UtcDaliToolkitScrollModeP1(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" ); + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 pageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetSize( pageSize ); + scrollView.SetParentOrigin( ParentOrigin::CENTER ); + scrollView.SetAnchorPoint( AnchorPoint::CENTER ); + scrollView.SetPosition( 0.0f, 0.0f, 0.0f ); + + // Position rulers. + Property::Map rulerMap; + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true ); + rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, pageSize.width ); + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, pageSize.width*3 ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, false ); + scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); + + scrollView.SetWrapMode( false ); + scrollView.SetScrollSensitive( true ); + + Stage::GetCurrent().Add( scrollView ); + + // Set up a gesture to perform. + Vector2 startPos( 50.0f, 0.0f ); + Vector2 direction( -5.0f, 0.0f ); + int frames = 200; + + // Force starting position. + scrollView.ScrollTo( startPos, 0.0f ); + Wait( application ); + + // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins. + Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) ); + + // Confirm the final X coord has not moved more than one page from the start X position. + DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION ); + + // Finish the gesture and wait for the snap. + currentPos += direction; + SendPan( application, Gesture::Finished, currentPos ); + // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first. + Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); + + // Confirm the final X coord has snapped to exactly one page ahead of the start page. + DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollModeP2(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" ); + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 pageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetSize( pageSize ); + scrollView.SetParentOrigin( ParentOrigin::CENTER ); + scrollView.SetAnchorPoint( AnchorPoint::CENTER ); + scrollView.SetPosition( 0.0f, 0.0f, 0.0f ); + + // Position rulers. + Property::Map rulerMap; + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true ); + rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 ); + scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); + + scrollView.SetWrapMode( false ); + scrollView.SetScrollSensitive( true ); + + Stage::GetCurrent().Add( scrollView ); + + // Set up a gesture to perform. + Vector2 startPos( 0.0f, 50.0f ); + Vector2 direction( 0.0f, -6.0f ); + int frames = 200; + + // Force starting position. + scrollView.ScrollTo( startPos, 0.0f ); + Wait( application ); + + // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins. + Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) ); + + // Confirm the final X coord has not moved more than one page from the start X position. + DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION ); + + // Finish the gesture and wait for the snap. + currentPos += direction; + SendPan( application, Gesture::Finished, currentPos ); + // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first. + Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); + + // Confirm the final Y coord has snapped to exactly one page ahead of the start page. + DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollModeP3(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliToolkitScrollView ScrollMode property" ); + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 pageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetSize( pageSize ); + scrollView.SetParentOrigin( ParentOrigin::CENTER ); + scrollView.SetAnchorPoint( AnchorPoint::CENTER ); + scrollView.SetPosition( 0.0f, 0.0f, 0.0f ); + + // Position rulers. + Property::Map rulerMap; + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true ); + rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 ); + scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); + + scrollView.SetWrapMode( false ); + scrollView.SetScrollSensitive( true ); + + Stage::GetCurrent().Add( scrollView ); + + // Set up a gesture to perform. + Vector2 startPos( 0.0f, 50.0f ); + Vector2 direction( 0.0f, -6.0f ); + int frames = 200; + + // Force starting position. + scrollView.ScrollTo( startPos, 0.0f ); + Wait( application ); + + // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins. + Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) ); + + // Confirm the final X coord has not moved more than one page from the start X position. + DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION ); + + // Finish the gesture and wait for the snap. + currentPos += direction; + SendPan( application, Gesture::Finished, currentPos ); + // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first. + Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); + + // Confirm the final Y coord has snapped to exactly one page ahead of the start page. + DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollModeP4(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliToolkitScrollView ScrollMode property, DefaultRulers" ); + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 pageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetSize( pageSize ); + scrollView.SetParentOrigin( ParentOrigin::TOP_LEFT ); + scrollView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + scrollView.SetPosition( 0.0f, 0.0f, 0.0f ); + + // Position rulers - expect Default rulers to be used which don't snap + Property::Map rulerMap; + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true ); + scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); + + scrollView.SetWrapMode( false ); + scrollView.SetScrollSensitive( true ); + + Stage::GetCurrent().Add( scrollView ); + + Vector2 START_POSITION = Vector2(10.0f, 10.0f); + + scrollView.ScrollTo(START_POSITION, 0.0f); + Wait(application); + // Try a vertical swipe. + PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); + // Take into account resampling done when prediction is off. + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); + + + END_TEST; +} + int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void) { ToolkitTestApplication application; @@ -685,6 +961,9 @@ int UtcDaliToolkitScrollViewSetWrapModeP(void) ScrollView scrollView = ScrollView::New(); Stage::GetCurrent().Add( scrollView ); + Actor actor = Actor::New(); + scrollView.Add( actor ); + // Position rulers. 4x4 grid. RulerPtr rulerX = new FixedRuler(50.0f); RulerPtr rulerY = new FixedRuler(50.0f); @@ -697,7 +976,10 @@ int UtcDaliToolkitScrollViewSetWrapModeP(void) scrollView.ScrollTo(Vector2(225.0f, 125.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped) Wait(application); DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 17, TEST_LOCATION ); + scrollView.SetWrapMode(true); + scrollView.ScrollTo(Vector2(230.0f, 130.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped) + Wait(application); DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 13, TEST_LOCATION ); END_TEST; } @@ -779,7 +1061,7 @@ int UtcDaliToolkitScrollViewSignalsStartComplete(void) END_TEST; } -int UtcDaliToolkitScrollViewSignalsUpdate(void) +int UtcDaliToolkitScrollViewSignalsUpdate01(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate"); @@ -806,7 +1088,7 @@ int UtcDaliToolkitScrollViewSignalsUpdate(void) scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); - ImageActor image = CreateSolidColorActor( Color::RED ); + Actor image = Actor::New(); image.SetSize(stageSize); image.SetParentOrigin(ParentOrigin::TOP_LEFT); image.SetAnchorPoint(AnchorPoint::TOP_LEFT); @@ -839,34 +1121,71 @@ int UtcDaliToolkitScrollViewSignalsUpdate(void) END_TEST; } -static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true) +int UtcDaliToolkitScrollViewSignalsUpdate02(void) { + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate"); + gOnScrollStartCalled = false; gOnScrollUpdateCalled = false; gOnScrollCompleteCalled = false; - gOnSnapStartCalled = false; - // Now do a pan starting from (start) and heading (direction) - Vector2 pos(start); + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + Dali::ConnectionTracker tracker; + bool scrollStarted=false; + bool scrollUpdated=false; + bool scrollCompleted=false; + DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) )); + DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) )); + DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) )); + + Actor image = Actor::New(); + image.SetSize(stageSize); + image.SetParentOrigin(ParentOrigin::TOP_LEFT); + image.SetAnchorPoint(AnchorPoint::TOP_LEFT); + scrollView.Add(image); + + Wait(application); + + // Do a pan starting from 100,100 and moving down diagonally. + Vector2 pos(100.0f, 100.0f); SendPan(application, Gesture::Possible, pos); SendPan(application, Gesture::Started, pos); - Wait(application); + pos.x += 5.0f; + pos.y += 5.0f; + Wait(application, 100); - for(int i = 0;i(), overshootSize, TEST_LOCATION ); + Stage::GetCurrent().Add( scrollView ); Vector2 stageSize = Stage::GetCurrent().GetSize(); scrollView.SetSize(stageSize); @@ -1110,9 +1436,9 @@ int UtcDaliToolkitScrollViewOvershoot(void) // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch) Vector2 currentPos = Vector2(100.0f, 100.0f); currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false); - float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); - Vector2 positionValue = scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION); + float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); + Vector2 positionValue = scrollView.GetCurrentProperty< Vector2 >( ScrollView::Property::SCROLL_POSITION ); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(positionValue, Vector2::ZERO, TEST_LOCATION); @@ -1309,22 +1635,25 @@ int UtcDaliToolkitScrollViewSetMaxOvershootP(void) // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch) Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false); - float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION); // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch) currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false); - overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); - DALI_TEST_CHECK(overshootXValue > 0.49f && overshootXValue < 0.51f); - DALI_TEST_CHECK(overshootYValue > 0.49f && overshootYValue < 0.51f); + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); + // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot. + // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105. + float correctOvershootValue = 50.0f / 105.f; + DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION ); // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch) currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false); - overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); @@ -1333,15 +1662,15 @@ int UtcDaliToolkitScrollViewSetMaxOvershootP(void) Wait(application); // Check that overshoot should be now around 0.8. - overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f); DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f); // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch) currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false); - overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); - overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); + overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); @@ -1367,7 +1696,8 @@ int UtcDaliToolkitScrollViewSetScrollingDirectionP(void) Wait(application); // Try a vertical swipe. PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(10.0f, -50.0f), TEST_LOCATION ); + // Take into account resampling done when prediction is off. + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL); @@ -1383,7 +1713,7 @@ int UtcDaliToolkitScrollViewSetScrollingDirectionP(void) Wait(application); // Try a vertical swipe. PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(10.0f, -50.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); END_TEST; } @@ -1417,7 +1747,8 @@ int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void) Wait(application); // Try a vertical swipe. PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(10.0f, -50.0f), TEST_LOCATION ); + // Take into account resampling done when prediction is off. + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); END_TEST; } @@ -1505,17 +1836,17 @@ int UtcDaliToolkitScrollViewSetMinimumDistanceForFlickP(void) END_TEST; } -int UtcDaliToolkitScrollViewSetMouseWheelScrollDistanceStepP(void) +int UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliToolkitScrollViewSetMouseWheelScrollDistanceStepP"); + tet_infoline(" UtcDaliToolkitScrollViewSetWheelScrollDistanceStepP"); ScrollView scrollView = ScrollView::New(); // Disable Refresh signal (TET environment cannot use adaptor's Timer) - scrollView.SetMouseWheelScrollDistanceStep(Vector2(30.0f, 15.0f)); - DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION ); - scrollView.SetMouseWheelScrollDistanceStep(Vector2(60.0f, 30.0f)); - DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION); + scrollView.SetWheelScrollDistanceStep(Vector2(30.0f, 15.0f)); + DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION ); + scrollView.SetWheelScrollDistanceStep(Vector2(60.0f, 30.0f)); + DALI_TEST_EQUALS( scrollView.GetWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION); END_TEST; } @@ -2006,6 +2337,18 @@ int UtcDaliToolkitScrollViewFixedRulerGetPositionFromPageP(void) position = rulerNormal->GetPositionFromPage(2, volume, true); DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION ); DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION ); + + // Disable the ruler + rulerNormal->Disable(); + + position = rulerNormal->GetPositionFromPage(1, volume, true); + DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION ); + + position = rulerNormal->GetPositionFromPage(2, volume, true); + DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION ); + END_TEST; } @@ -2103,6 +2446,21 @@ int UtcDaliToolkitScrollViewFixedRulerGetPageFromPositionP(void) DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION); DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION); + // Set domain size to be smaller than the ruler space + fixedRuler->SetDomain( RulerDomain(0.0f, 50.0f, true) ); + + fixedRuler->Enable(); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 3u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION); + + fixedRuler->Disable(); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, true), 0u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(250.0f, false), 0u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, true), 0u, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetPageFromPosition(-350.0f, false), 0u, TEST_LOCATION); + END_TEST; } @@ -2153,6 +2511,323 @@ int UtcDaliToolkitScrollViewFixedRulerSnapP(void) END_TEST; } +int UtcDaliToolkitScrollViewConstraintsMove(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove"); + + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + + // Add an Actor to ScrollView, + Actor a = Actor::New(); + scrollView.Add(a); + a.SetPosition( TEST_ACTOR_POSITION ); + Wait(application); + + const Vector2 target = Vector2(100.0f, 100.0f); + const Vector2 target2 = Vector2(200.0f, 200.0f); + + Constraint constraint = Constraint::New( scrollView, Actor::Property::POSITION, MoveActorConstraint ); + constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) ); + constraint.SetRemoveAction(Constraint::Discard); + scrollView.ApplyConstraintToChildren(constraint); + + scrollView.ScrollTo( target, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); + scrollView.ScrollTo( target2 ); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollViewConstraintsWrap(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap"); + // Set up a scrollView... + ScrollView scrollView = ScrollView::New(); + Stage::GetCurrent().Add( scrollView ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); + scrollView.SetSize(stageSize); + scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + // Position rulers. + RulerPtr rulerX = new DefaultRuler(); + RulerPtr rulerY = new DefaultRuler(); + rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); + rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); + scrollView.SetRulerX(rulerX); + scrollView.SetRulerY(rulerY); + // Add an Actor to ScrollView, + Actor a = Actor::New(); + scrollView.Add(a); + a.SetPosition( TEST_ACTOR_POSITION ); + Wait(application); + + const Vector2 target = Vector2(100.0f, 100.0f); + const Vector2 target2 = Vector2(200.0f, 200.0f); + + Constraint constraint = Constraint::New( scrollView, Actor::Property::POSITION, WrapActorConstraint ); + constraint.AddSource( LocalSource( Actor::Property::SCALE ) ); + constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) ); + constraint.AddSource( LocalSource( Actor::Property::SIZE ) ); + constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) ); + constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) ); + constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) ); + constraint.SetRemoveAction(Constraint::Discard); + scrollView.ApplyConstraintToChildren(constraint); + + scrollView.ScrollTo( target, 0.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); + scrollView.ScrollTo( target2 ); + Wait(application, RENDER_DELAY_SCROLL); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); + + scrollView.Remove(a); + Wait(application); + + END_TEST; +} + +// Non-API test (so no P or N variant). +int UtcDaliToolkitScrollViewGesturePageLimit(void) +{ + ToolkitTestApplication application; + tet_infoline( " UtcDaliToolkitScrollViewGesturePageLimit" ); + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 pageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetSize( pageSize ); + scrollView.SetParentOrigin( ParentOrigin::CENTER ); + scrollView.SetAnchorPoint( AnchorPoint::CENTER ); + scrollView.SetPosition( 0.0f, 0.0f, 0.0f ); + + // Position rulers. + // We set the X ruler to fixed to give us pages to snap to. + Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( pageSize.width ); + // Note: The 3x page width is arbitary, but we need enough to show that we are + // capping page movement by the page limiter, and not the domain. + rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, pageSize.width * 3.0f, false ) ); + Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler(); + rulerY->Disable(); + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + + scrollView.SetWrapMode( false ); + scrollView.SetScrollSensitive( true ); + + Stage::GetCurrent().Add( scrollView ); + + // Set up a gesture to perform. + Vector2 startPos( 50.0f, 0.0f ); + Vector2 direction( -5.0f, 0.0f ); + int frames = 200; + + // Force starting position. + scrollView.ScrollTo( startPos, 0.0f ); + Wait( application ); + + // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins. + Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) ); + + // Confirm the final X coord has not moved more than one page from the start X position. + DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION ); + + // Finish the gesture and wait for the snap. + currentPos += direction; + SendPan( application, Gesture::Finished, currentPos ); + // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first. + Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); + + // Confirm the final X coord has snapped to exactly one page ahead of the start page. + DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliScrollViewSetGetProperty(void) +{ + ToolkitTestApplication application; + + // Create the ScrollView actor + ScrollView scrollView = ScrollView::New(); + DALI_TEST_CHECK(scrollView); + + // Event side properties + + // Test "wrapEnabled" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED ); + scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get(), true, TEST_LOCATION ); + + // Test "panningEnabled" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED ); + scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get(), false, TEST_LOCATION ); + + // Test "axisAutoLockEnabled" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED ); + scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get(), false, TEST_LOCATION ); + + // Test "wheelScrollDistanceStep" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP ); + scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get(), Vector2(100.0f, 50.0f), TEST_LOCATION ); + + // Test "overshootEnabled" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED ); + DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get(), scrollView.IsOvershootEnabled(), TEST_LOCATION ); + scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false ); + DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get(), false, TEST_LOCATION ); + + // Animatable properties + + // Test "scrollPosition" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get(), Vector2(320.0f, 550.0f), TEST_LOCATION ); + + // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get(), Vector2(300.0f, 500.0f), TEST_LOCATION ); + + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X ); + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get(), 300.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get(), 500.0f, TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get(), 400.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get(), 600.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get(), Vector2(400.0f, 600.0f), TEST_LOCATION ); + + // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get(), Vector2(100.0f, 200.0f), TEST_LOCATION ); + + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X ); + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get(), 100.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get(), 200.0f, TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f ); + scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get(), 300.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get(), 400.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get(), Vector2(300.0f, 400.0f), TEST_LOCATION ); + + // Test "overshootX" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X ); + scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get(), 0.8f, TEST_LOCATION ); + + // Test "overshootY" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y ); + scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get(), 0.8f, TEST_LOCATION ); + + // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL ); + scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get(), Vector2(200.0f, 300.0f), TEST_LOCATION ); + + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X ); + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get(), 200.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get(), 300.0f, TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f ); + scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get(), 500.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get(), 600.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get(), Vector2(500.0f, 600.0f), TEST_LOCATION ); + + // Test "wrap" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP ); + scrollView.SetProperty( ScrollView::Property::WRAP, false ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get(), false, TEST_LOCATION ); + + // Test "panning" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING ); + scrollView.SetProperty( ScrollView::Property::PANNING, true ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get(), true, TEST_LOCATION ); + + // Test "scrolling" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING ); + scrollView.SetProperty( ScrollView::Property::SCROLLING, false ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get(), false, TEST_LOCATION ); + + // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE ); + scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get(), Vector2(1200.0f, 1300.0f), TEST_LOCATION ); + + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X ); + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get(), 1200.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get(), 1300.0f, TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f ); + scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get(), 1500.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get(), 1600.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get(), Vector2(1500.0f, 1600.0f), TEST_LOCATION ); + + // Test "scrollDomainOffset" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET ); + scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get(), Vector2(500.0f, 200.0f), TEST_LOCATION ); + + // Test "scrollPositionDelta" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA ); + scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get(), Vector2(10.0f, 30.0f), TEST_LOCATION ); + + // Test "startPagePosition" property + DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION ); + scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) ); + Wait(application); + DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION ); + + END_TEST; +}