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=ebba4e9f3fdfde830142e3dcf5190653bb3f93b5;hp=3e66bf1e93dfe967cbfff5bcd2186ed090d65246;hb=6154e1e69b7cd3afb49213c4f6f5730dd3df074e;hpb=b514a4671789bee2f03b0177393b9a21f62ac2c3 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 3e66bf1..ebba4e9 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) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -20,6 +20,7 @@ #include #include #include +#include using namespace Dali; using namespace Toolkit; @@ -113,6 +114,7 @@ static bool gOnScrollStartCalled; ///< Whether the OnScrol static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked. static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked. static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked. +static bool gOnWheelEventCalled; ///< Whether the WheelEventSignal signal was invoked. static SnapType gLastSnapType; ///< Snaping information from SnapEvent. static Vector3 gConstraintResult; ///< Result from constraint. @@ -158,6 +160,19 @@ static void OnSnapStart( const ScrollView::SnapEvent& event ) } /** + * Invoked after a wheel-event is received + * + * @param[in] actor The owing actor + * @param[in] event The wheel event + * @return True if the event should be consumed + */ +static bool OnWheelEvent( Actor actor, const Dali::WheelEvent& wheelEvent ) +{ + gOnWheelEventCalled = true; + return false; +} + +/** * TestSumConstraint * * Summation of current value, property, and offset. @@ -289,6 +304,24 @@ int UtcDaliToolkitScrollViewCopyConstructorP(void) END_TEST; } +int UtcDaliScrollViewMoveConstructor(void) +{ + ToolkitTestApplication application; + + ScrollView scrollView = ScrollView::New(); + DALI_TEST_EQUALS( 1, scrollView.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) ); + DALI_TEST_EQUALS( scrollView.GetProperty( ScrollView::Property::SCROLL_POSITION ), Vector2(10.0f, 10.0f), TEST_LOCATION ); + + ScrollView moved = std::move( scrollView ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( moved.GetProperty( ScrollView::Property::SCROLL_POSITION ), Vector2(10.0f, 10.0f), TEST_LOCATION ); + DALI_TEST_CHECK( !scrollView ); + + END_TEST; +} + int UtcDaliToolkitScrollViewAssignmentOperatorP(void) { ToolkitTestApplication application; @@ -296,12 +329,32 @@ int UtcDaliToolkitScrollViewAssignmentOperatorP(void) ScrollView scrollView = ScrollView::New(); scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) ); - ScrollView copy = scrollView; + ScrollView copy; + copy = scrollView; DALI_TEST_CHECK( copy ); DALI_TEST_CHECK( copy.GetProperty( ScrollView::Property::SCROLL_POSITION ) == scrollView.GetProperty( ScrollView::Property::SCROLL_POSITION ) ); END_TEST; } +int UtcDaliScrollViewMoveAssignment(void) +{ + ToolkitTestApplication application; + + ScrollView scrollView = ScrollView::New(); + DALI_TEST_EQUALS( 1, scrollView.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(10.0f, 10.0f) ); + DALI_TEST_EQUALS( scrollView.GetProperty( ScrollView::Property::SCROLL_POSITION ), Vector2(10.0f, 10.0f), TEST_LOCATION ); + + ScrollView moved; + moved = std::move( scrollView ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( moved.GetProperty( ScrollView::Property::SCROLL_POSITION ), Vector2(10.0f, 10.0f), TEST_LOCATION ); + DALI_TEST_CHECK( !scrollView ); + + END_TEST; +} + int UtcDaliScrollViewDestructorP(void) { ToolkitTestApplication application; @@ -331,7 +384,7 @@ int UtcDaliToolkitScrollViewNewP1(void) DALI_TEST_CHECK( scrollView2 == scrollView ); //Additional check to ensure object is created by checking if it's registered - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; @@ -383,7 +436,7 @@ int UtcDaliToolkitScrollViewScrollToPositionP(void) // Create the ScrollView actor ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); const Vector2 target = Vector2(100.0f, 200.0f); const Vector2 target2 = Vector2(300.0f, 100.0f); @@ -404,7 +457,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void) tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -425,7 +478,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void) Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); - scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft ); + scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DIRECTION_BIAS_LEFT, Dali::Toolkit::DIRECTION_BIAS_LEFT ); Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); @@ -433,7 +486,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithDirectionBiasP(void) Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); - scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight ); + scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DIRECTION_BIAS_RIGHT, Dali::Toolkit::DIRECTION_BIAS_RIGHT ); Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); @@ -447,7 +500,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionP(void) // Create the ScrollView actor ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); const Vector2 target = Vector2(100.0f, 200.0f); const Vector2 target2 = Vector2(300.0f, 100.0f); @@ -476,7 +529,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(v tet_infoline(" UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -494,7 +547,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(v Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); - scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft ); + scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DIRECTION_BIAS_LEFT, Dali::Toolkit::DIRECTION_BIAS_LEFT ); Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); @@ -502,7 +555,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(v Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); - scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight ); + scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DIRECTION_BIAS_RIGHT, Dali::Toolkit::DIRECTION_BIAS_RIGHT ); Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); @@ -510,7 +563,7 @@ int UtcDaliToolkitScrollViewScrollToPositionWithAlphaFunctionAndDirectionBiasP(v Wait(application, RENDER_DELAY_SCROLL); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION ); - scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DirectionBiasRight, Dali::Toolkit::DirectionBiasRight ); + scrollView.ScrollTo( target2, 0.25f, TestAlphaFunction, Dali::Toolkit::DIRECTION_BIAS_RIGHT, Dali::Toolkit::DIRECTION_BIAS_RIGHT ); Wait(application, 125); // Check that the scroll animation should finish within just half of the specified duration with the above alpha function DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION ); @@ -524,7 +577,7 @@ int UtcDaliToolkitScrollViewScrollToPageP(void) tet_infoline(" UtcDaliToolkitScrollViewScrollToPageP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -588,25 +641,25 @@ int UtcDaliToolkitScrollModeP1(void) ScrollView scrollView = ScrollView::New(); // Do not rely on stage size for UTC tests. - Vector2 pageSize( 720.0f, 1280.0f ); + Vector2 viewPageSize( 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 ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 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::X_AXIS_SNAP_TO_INTERVAL, viewPageSize.width ); + rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, viewPageSize.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 ); + application.GetScene().Add( scrollView ); // Set up a gesture to perform. Vector2 startPos( 50.0f, 0.0f ); @@ -622,7 +675,7 @@ int UtcDaliToolkitScrollModeP1(void) Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, 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 ); + DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION ); // Finish the gesture and wait for the snap. currentPos += direction; @@ -631,7 +684,19 @@ int UtcDaliToolkitScrollModeP1(void) time += 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 ); + DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + // Change scroll mode during pan, should not crash + PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ); + try + { + scrollView.SetScrollSensitive(false); + DALI_TEST_CHECK(true); + } + catch(...) + { + DALI_TEST_CHECK(false); + } END_TEST; } @@ -645,25 +710,25 @@ int UtcDaliToolkitScrollModeP2(void) ScrollView scrollView = ScrollView::New(); // Do not rely on stage size for UTC tests. - Vector2 pageSize( 720.0f, 1280.0f ); + Vector2 viewPageSize( 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 ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 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 ); + rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 ); scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); scrollView.SetWrapMode( false ); scrollView.SetScrollSensitive( true ); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); // Set up a gesture to perform. Vector2 startPos( 0.0f, 50.0f ); @@ -679,7 +744,7 @@ int UtcDaliToolkitScrollModeP2(void) Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, 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 ); + DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION ); // Finish the gesture and wait for the snap. currentPos += direction; @@ -689,7 +754,7 @@ int UtcDaliToolkitScrollModeP2(void) 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 ); + DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION ); END_TEST; } @@ -703,25 +768,25 @@ int UtcDaliToolkitScrollModeP3(void) ScrollView scrollView = ScrollView::New(); // Do not rely on stage size for UTC tests. - Vector2 pageSize( 720.0f, 1280.0f ); + Vector2 viewPageSize( 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 ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 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 ); + rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height ); + rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 ); scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap); scrollView.SetWrapMode( false ); scrollView.SetScrollSensitive( true ); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); // Set up a gesture to perform. Vector2 startPos( 0.0f, 50.0f ); @@ -737,7 +802,7 @@ int UtcDaliToolkitScrollModeP3(void) Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, 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 ); + DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION ); // Finish the gesture and wait for the snap. currentPos += direction; @@ -746,7 +811,7 @@ int UtcDaliToolkitScrollModeP3(void) 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 ); + DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION ); END_TEST; } @@ -760,12 +825,12 @@ int UtcDaliToolkitScrollModeP4(void) ScrollView scrollView = ScrollView::New(); // Do not rely on stage size for UTC tests. - Vector2 pageSize( 720.0f, 1280.0f ); + Vector2 viewPageSize( 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 ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f )); // Position rulers - expect Default rulers to be used which don't snap Property::Map rulerMap; @@ -776,7 +841,7 @@ int UtcDaliToolkitScrollModeP4(void) scrollView.SetWrapMode( false ); scrollView.SetScrollSensitive( true ); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); Vector2 START_POSITION = Vector2(10.0f, 10.0f); @@ -817,7 +882,7 @@ int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void) tet_infoline(" UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -828,7 +893,7 @@ int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void) scrollView.SetWrapMode(true); - scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasLeft ); + scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DIRECTION_BIAS_LEFT ); Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame // Check that the scroll position remains the same @@ -839,7 +904,7 @@ int UtcDaliToolkitScrollViewScrollToPageWithDirectionBiasP(void) DALI_TEST_EQUALS( static_cast(scrollView.GetCurrentPage()), 0, TEST_LOCATION ); DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2(0.0f, 0.0f), TEST_LOCATION ); - scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DirectionBiasRight ); + scrollView.ScrollTo( 0, 0.25, Dali::Toolkit::DIRECTION_BIAS_RIGHT ); Wait(application, RENDER_FRAME_INTERVAL); // Wait for one frame // Check that it scrolls towards the right @@ -859,16 +924,16 @@ int UtcDaliToolkitScrollViewScrollToActorP(void) tet_infoline(" UtcDaliToolkitScrollViewScrollToActorP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); Actor actorA = Actor::New(); const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f); - actorA.SetPosition(positionA); + actorA.SetProperty( Actor::Property::POSITION, positionA ); scrollView.Add(actorA); Actor actorB = Actor::New(); const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f); - actorB.SetPosition(positionB); + actorB.SetProperty( Actor::Property::POSITION, positionB ); scrollView.Add(actorB); Wait(application); @@ -898,7 +963,7 @@ int UtcDaliToolkitScrollViewScrollToSnapPointP(void) tet_infoline(" UtcDaliToolkitScrollViewScrollToSnapPointP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -940,7 +1005,7 @@ int UtcDaliToolkitScrollViewSetWrapModeP(void) tet_infoline(" UtcDaliToolkitScrollViewSetWrapModeP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); Actor actor = Actor::New(); scrollView.Add( actor ); @@ -971,7 +1036,7 @@ int UtcDaliToolkitScrollViewActorAutoSnap(void) tet_infoline(" UtcDaliToolkitScrollViewActorAutoSnap"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -984,12 +1049,12 @@ int UtcDaliToolkitScrollViewActorAutoSnap(void) const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f); Actor a = Actor::New(); scrollView.Add(a); - a.SetPosition(aPosition); + a.SetProperty( Actor::Property::POSITION, aPosition ); const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f); Actor b = Actor::New(); scrollView.Add(b); - b.SetPosition(bPosition); + b.SetProperty( Actor::Property::POSITION, bPosition ); // Goto a random position, and execute snap (should not move) Vector2 targetScroll = Vector2(500.0f, 500.0f); @@ -1022,7 +1087,7 @@ int UtcDaliToolkitScrollViewSignalsStartComplete(void) gOnScrollCompleteCalled = false; ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1052,11 +1117,11 @@ int UtcDaliToolkitScrollViewSignalsUpdate01(void) gOnScrollCompleteCalled = false; 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1070,9 +1135,9 @@ int UtcDaliToolkitScrollViewSignalsUpdate01(void) scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); Actor image = Actor::New(); - image.SetSize(stageSize); - image.SetParentOrigin(ParentOrigin::TOP_LEFT); - image.SetAnchorPoint(AnchorPoint::TOP_LEFT); + image.SetProperty( Actor::Property::SIZE, stageSize); + image.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + image.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); scrollView.Add(image); Wait(application); @@ -1114,11 +1179,11 @@ int UtcDaliToolkitScrollViewSignalsUpdate02(void) gOnScrollCompleteCalled = false; 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1136,9 +1201,9 @@ int UtcDaliToolkitScrollViewSignalsUpdate02(void) 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); + image.SetProperty( Actor::Property::SIZE, stageSize); + image.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + image.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); scrollView.Add(image); Wait(application); @@ -1168,7 +1233,7 @@ int UtcDaliToolkitScrollViewSignalsUpdate02(void) DALI_TEST_CHECK(scrollUpdated); DALI_TEST_CHECK(scrollCompleted); - Stage::GetCurrent().Remove( scrollView ); + application.GetScene().Remove( scrollView ); END_TEST; } @@ -1181,11 +1246,11 @@ int UtcDaliToolkitScrollViewScrollSensitive(void) // Set up a scrollView... ScrollView scrollView = ScrollView::New(); scrollView.SetOvershootEnabled(true); - Stage::GetCurrent().Add( scrollView ); - Vector2 stageSize = Stage::GetCurrent().GetSize(); - scrollView.SetSize(stageSize); - scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1228,11 +1293,11 @@ int UtcDaliToolkitScrollViewAxisAutoLock(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1333,11 +1398,11 @@ int UtcDaliToolkitScrollViewConstraints(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1352,12 +1417,12 @@ int UtcDaliToolkitScrollViewConstraints(void) gConstraintResult = Vector3::ZERO; Actor a = Actor::New(); scrollView.Add(a); - a.SetPosition( TEST_ACTOR_POSITION ); + a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION); Wait(application); Constraint constraint = Constraint::New( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) ); - constraint.SetRemoveAction(Constraint::Discard); + constraint.SetRemoveAction(Constraint::DISCARD); scrollView.ApplyConstraintToChildren(constraint); Wait(application); @@ -1378,11 +1443,11 @@ int UtcDaliToolkitScrollViewBind(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1398,13 +1463,13 @@ int UtcDaliToolkitScrollViewBind(void) gConstraintResult = Vector3::ZERO; Actor a = Actor::New(); scrollView.Add(a); - a.SetPosition( TEST_ACTOR_POSITION ); + a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION); Wait(application); // apply this constraint to scrollview Constraint constraint = Constraint::New( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) ); - constraint.SetRemoveAction(Constraint::Discard); + constraint.SetRemoveAction(Constraint::DISCARD); scrollView.ApplyConstraintToChildren(constraint); Wait(application); @@ -1439,11 +1504,11 @@ int UtcDaliToolkitScrollViewOvershoot(void) scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize ); DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get(), overshootSize, TEST_LOCATION ); - Stage::GetCurrent().Add( scrollView ); - Vector2 stageSize = Stage::GetCurrent().GetSize(); - scrollView.SetSize(stageSize); - scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1571,11 +1636,11 @@ int UtcDaliToolkitScrollViewSnapStartedSignalP(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1594,13 +1659,13 @@ int UtcDaliToolkitScrollViewSnapStartedSignalP(void) PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, time, true); DALI_TEST_CHECK( gOnSnapStartCalled ); - DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap ); + DALI_TEST_CHECK( gLastSnapType == Toolkit::SNAP ); // Second try a swipe. PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, time, true); DALI_TEST_CHECK( gOnSnapStartCalled ); - DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick ); + DALI_TEST_CHECK( gLastSnapType == Toolkit::FLICK ); END_TEST; } @@ -1610,7 +1675,7 @@ int UtcDaliToolkitScrollViewGetCurrentPageP(void) tet_infoline(" UtcDaliToolkitScrollViewGetCurrentPageP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); RulerPtr rulerY = new FixedRuler( 100.0f ); @@ -1641,11 +1706,11 @@ int UtcDaliToolkitScrollViewSetMaxOvershootP(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -1732,11 +1797,11 @@ int UtcDaliToolkitScrollViewSetScrollingDirectionP(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Vector2 START_POSITION = Vector2(10.0f, 10.0f); @@ -1818,11 +1883,11 @@ int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); Vector2 START_POSITION = Vector2(10.0f, 10.0f); uint32_t time = 0; @@ -1882,7 +1947,7 @@ int UtcDaliToolkitScrollViewSetRulerXP(void) tet_infoline(" UtcDaliToolkitScrollViewSetRulerXP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerX = new FixedRuler( 100.0f ); rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) ); @@ -1910,7 +1975,7 @@ int UtcDaliToolkitScrollViewSetRulerYP(void) tet_infoline(" UtcDaliToolkitScrollViewSetRulerYP"); ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); RulerPtr rulerY = new FixedRuler( 200.0f ); rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) ); @@ -2260,15 +2325,15 @@ int UtcDaliToolkitScrollViewRulerDomainClampWithStateP(void) ClampState clamped; float value = domainX.Clamp(50.0f, 100.0f, 1.0f, clamped); DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, Dali::Toolkit::NotClamped, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, Dali::Toolkit::NOT_CLAMPED, TEST_LOCATION); value = domainX.Clamp(-100.0f, 200.0f, 1.0f, clamped); DALI_TEST_EQUALS( value, 0.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMin, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, Dali::Toolkit::CLAMPED_TO_MIN, TEST_LOCATION); value = domainX.Clamp(300.0f, 20.0f, 1.0f, clamped); DALI_TEST_EQUALS( value, 180.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, Dali::Toolkit::ClampedToMax, TEST_LOCATION); + DALI_TEST_EQUALS( clamped, Dali::Toolkit::CLAMPED_TO_MAX, TEST_LOCATION); END_TEST; } @@ -2327,11 +2392,11 @@ int UtcDaliToolkitScrollViewRulerGetTypeP(void) RulerPtr defaultRuler = new DefaultRuler(); DALI_TEST_CHECK( defaultRuler ); - DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::Free, TEST_LOCATION); + DALI_TEST_EQUALS( defaultRuler->GetType(), Dali::Toolkit::Ruler::FREE, TEST_LOCATION); RulerPtr fixedRuler = new FixedRuler( 100.0f ); DALI_TEST_CHECK( fixedRuler ); - DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::Fixed, TEST_LOCATION); + DALI_TEST_EQUALS( fixedRuler->GetType(), Dali::Toolkit::Ruler::FIXED, TEST_LOCATION); END_TEST; } @@ -2428,17 +2493,17 @@ int UtcDaliToolkitScrollViewRulerSnapAndClamp(void) // clamp state testing. ClampState clamped; DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, NOT_CLAMPED, TEST_LOCATION ); DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, NOT_CLAMPED, TEST_LOCATION ); DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, NOT_CLAMPED, TEST_LOCATION ); DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, CLAMPED_TO_MIN, TEST_LOCATION ); DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, NOT_CLAMPED, TEST_LOCATION ); DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION); - DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION ); + DALI_TEST_EQUALS( clamped, CLAMPED_TO_MAX, TEST_LOCATION ); END_TEST; } @@ -2641,11 +2706,11 @@ int UtcDaliToolkitScrollViewConstraintsMove(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -2658,7 +2723,7 @@ int UtcDaliToolkitScrollViewConstraintsMove(void) // Add an Actor to ScrollView, Actor a = Actor::New(); scrollView.Add(a); - a.SetPosition( TEST_ACTOR_POSITION ); + a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION); Wait(application); const Vector2 target = Vector2(100.0f, 100.0f); @@ -2666,7 +2731,7 @@ int UtcDaliToolkitScrollViewConstraintsMove(void) Constraint constraint = Constraint::New( scrollView, Actor::Property::POSITION, MoveActorConstraint ); constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) ); - constraint.SetRemoveAction(Constraint::Discard); + constraint.SetRemoveAction(Constraint::DISCARD); scrollView.ApplyConstraintToChildren(constraint); scrollView.ScrollTo( target, 0.0f ); @@ -2686,11 +2751,11 @@ int UtcDaliToolkitScrollViewConstraintsWrap(void) // 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); + application.GetScene().Add( scrollView ); + Vector2 stageSize = application.GetScene().GetSize(); + scrollView.SetProperty( Actor::Property::SIZE, stageSize); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); // Position rulers. RulerPtr rulerX = new DefaultRuler(); @@ -2703,7 +2768,7 @@ int UtcDaliToolkitScrollViewConstraintsWrap(void) // Add an Actor to ScrollView, Actor a = Actor::New(); scrollView.Add(a); - a.SetPosition( TEST_ACTOR_POSITION ); + a.SetProperty( Actor::Property::POSITION, TEST_ACTOR_POSITION); Wait(application); const Vector2 target = Vector2(100.0f, 100.0f); @@ -2716,7 +2781,7 @@ int UtcDaliToolkitScrollViewConstraintsWrap(void) 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); + constraint.SetRemoveAction(Constraint::DISCARD); scrollView.ApplyConstraintToChildren(constraint); scrollView.ScrollTo( target, 0.0f ); @@ -2742,19 +2807,19 @@ int UtcDaliToolkitScrollViewGesturePageLimit(void) ScrollView scrollView = ScrollView::New(); // Do not rely on stage size for UTC tests. - Vector2 pageSize( 720.0f, 1280.0f ); + Vector2 viewPageSize( 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 ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 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 ); + Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( viewPageSize.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 ) ); + rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, viewPageSize.width * 3.0f, false ) ); Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler(); rulerY->Disable(); scrollView.SetRulerX( rulerX ); @@ -2763,7 +2828,7 @@ int UtcDaliToolkitScrollViewGesturePageLimit(void) scrollView.SetWrapMode( false ); scrollView.SetScrollSensitive( true ); - Stage::GetCurrent().Add( scrollView ); + application.GetScene().Add( scrollView ); // Set up a gesture to perform. Vector2 startPos( 50.0f, 0.0f ); @@ -2779,7 +2844,7 @@ int UtcDaliToolkitScrollViewGesturePageLimit(void) Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, 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 ); + DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION ); // Finish the gesture and wait for the snap. currentPos += direction; @@ -2788,7 +2853,7 @@ int UtcDaliToolkitScrollViewGesturePageLimit(void) time += 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 ); + DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); END_TEST; } @@ -2955,3 +3020,81 @@ int UtcDaliScrollViewSetGetProperty(void) END_TEST; } + +int UtcDaliToolkitScrollViewWheelEvent(void) +{ + ToolkitTestApplication application; + + // Set up a scrollView. + ScrollView scrollView = ScrollView::New(); + + // Do not rely on stage size for UTC tests. + Vector2 viewPageSize( 720.0f, 1280.0f ); + scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + scrollView.SetProperty( Actor::Property::SIZE, viewPageSize ); + scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + scrollView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + scrollView.SetProperty( Actor::Property::POSITION, Vector3( 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( viewPageSize.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, viewPageSize.width * 3.0f, false ) ); + Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler(); + rulerY->Disable(); + scrollView.SetRulerX( rulerX ); + scrollView.SetRulerY( rulerY ); + + scrollView.SetWrapMode( false ); + + application.GetScene().Add( scrollView ); + + //Connect to wheel event signal + scrollView.WheelEventSignal().Connect( &OnWheelEvent ); + + DALI_TEST_CHECK( !gOnWheelEventCalled ); + + // Render and notify + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + // Perform a wheel event + Dali::Integration::WheelEvent wheelEvent( Dali::Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, Vector2( 10.0f, 10.0f ), 1, 1000u ); + application.ProcessEvent( wheelEvent ); + DALI_TEST_CHECK( gOnWheelEventCalled ); + + // Set X ruler to free + Dali::Toolkit::DefaultRuler* defaultRuler = new Dali::Toolkit::DefaultRuler(); + scrollView.SetRulerX( defaultRuler ); + + // Perform a wheel event + gOnWheelEventCalled = false; + application.ProcessEvent( wheelEvent ); + DALI_TEST_CHECK( gOnWheelEventCalled ); + + // Enable Y ruler + rulerY->Enable(); + + // Perform a wheel event + gOnWheelEventCalled = false; + application.ProcessEvent( wheelEvent ); + DALI_TEST_CHECK( gOnWheelEventCalled ); + + // Wait until it finishes scrolling + Wait(application, RENDER_DELAY_SCROLL); + + // Set Y ruler to fixed + Dali::Toolkit::FixedRuler* fixedRulerY = new Dali::Toolkit::FixedRuler( viewPageSize.height ); + scrollView.SetRulerY( fixedRulerY ); + + // Perform a wheel event + gOnWheelEventCalled = false; + application.ProcessEvent( wheelEvent ); + DALI_TEST_CHECK( gOnWheelEventCalled ); + + END_TEST; +}