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-ScrollBar.cpp;h=609621af320769aea492c87b1b106777b6c345ac;hp=ff4f5b9298bf482c833e352a23b8d586419f62fa;hb=b2e0875240ab94aeafce0f5a7d05f84a562184b7;hpb=a073ebfd862b49692c8e6d7dff2b128e62a4f6df diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp index ff4f5b9..609621a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 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. @@ -17,9 +17,12 @@ #include #include +#include #include +#include "dali-toolkit-test-utils/toolkit-timer.h" #include -#include +#include +#include using namespace Dali; using namespace Toolkit; @@ -39,48 +42,6 @@ namespace const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; -} - /* * Simulate time passed by. * @@ -117,6 +78,20 @@ static void OnPanFinished() gOnPanFinishedCalled = true; } +struct CallbackFunctor +{ + CallbackFunctor(bool* callbackFlag) + : mCallbackFlag( callbackFlag ) + { + } + + void operator()() + { + *mCallbackFlag = true; + } + bool* mCallbackFlag; +}; + /** * Invoked when the current scroll position of the scrollable content goes above or below the values * specified by SCROLL_POSITION_INTERVALS property. @@ -128,25 +103,31 @@ static void OnScrollPositionIntervalReached( float position ) gOnScrollPositionIntervalReachedSignalCalled = true; } -static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames) +static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t start_time) { gOnPanFinishedCalled = false; // Now do a pan starting from (start) and heading (direction) - Vector2 pos(start); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + Vector2 pos( start + ( direction * 15 ) ); + uint32_t time = start_time; + + TestStartPan( application, start, pos, time ); + Wait(application); for(int i = 0; i < frames; i++) { + Test::EmitGlobalTimerSignal(); + pos += direction; // Move in this direction - SendPan(application, Gesture::Continuing, pos); + time += RENDER_FRAME_INTERVAL; + TestMovePan( application, pos, time); Wait(application); } pos += direction; // Move in this direction. - SendPan(application, Gesture::Finished, pos); + time += RENDER_FRAME_INTERVAL; + TestEndPan(application, pos, time ); Wait(application); return pos; @@ -212,9 +193,47 @@ int UtcDaliToolkitScrollBarNewP(void) DALI_TEST_CHECK( vertical ); DALI_TEST_CHECK( vertical.GetScrollDirection() == ScrollBar::Vertical ); + Property::Value value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION); + std::string scrollDirection = value.Get(); + DALI_TEST_EQUALS( scrollDirection, "Vertical", TEST_LOCATION ); + ScrollBar horizontal = ScrollBar::New(ScrollBar::Horizontal); DALI_TEST_CHECK( horizontal ); DALI_TEST_CHECK( horizontal.GetScrollDirection() == ScrollBar::Horizontal ); + value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION); + scrollDirection = value.Get(); + DALI_TEST_EQUALS( scrollDirection, "Horizontal", TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarCreateP(void) +{ + ToolkitTestApplication application; + + TypeRegistry typeRegistry = TypeRegistry::Get(); + DALI_TEST_CHECK( typeRegistry ); + + TypeInfo typeInfo = typeRegistry.GetTypeInfo( "ScrollBar" ); + DALI_TEST_CHECK( typeInfo ); + + BaseHandle handle = typeInfo.CreateInstance(); + DALI_TEST_CHECK( handle ); + + ScrollBar scrollBar = ScrollBar::DownCast( handle ); + DALI_TEST_CHECK( scrollBar ); + + scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Vertical"); + scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Fixed"); + + DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Vertical, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Fixed, TEST_LOCATION ); + + scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Horizontal"); + scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Variable"); + + DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Horizontal, TEST_LOCATION ); + DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Variable, TEST_LOCATION ); END_TEST; } @@ -257,7 +276,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) DALI_TEST_CHECK( scrollBar.GetScrollDirection() == ScrollBar::Vertical ); float scrollBarHeight = 100.0f; - scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); // Create a source actor that owns the scroll properties required by the scroll bar @@ -287,7 +306,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) // Check that the indicator size should be: scroll bar size * (scroll bar size / content size). // i.e. The bigger the content size, the smaller the indicator size - float indicatorHeight = indicator.GetCurrentSize().y; + float indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION ); // Decrease the content length @@ -298,11 +317,11 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator size is changed accordingly - indicatorHeight = indicator.GetCurrentSize().y; + indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 250.0f, TEST_LOCATION ); // As scroll position is 0, check that the indicator position should be 0.0f. - float indicatorPosition = indicator.GetCurrentPosition().y; + float indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, 0.0f, TEST_LOCATION ); // Set the scroll position to the middle @@ -313,7 +332,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator should be in the middle of the scroll bar - indicatorPosition = indicator.GetCurrentPosition().y; + indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.5f, TEST_LOCATION ); // Set the scroll position to the maximum @@ -324,7 +343,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator should be in the end of the scroll bar - indicatorPosition = indicator.GetCurrentPosition().y; + indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, scrollBarHeight - indicatorHeight, TEST_LOCATION ); // Increase the maximum scroll position to double @@ -335,7 +354,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator should be now in the middle of the scroll bar - indicatorPosition = indicator.GetCurrentPosition().y; + indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.5f, TEST_LOCATION ); // Create another source actor @@ -361,11 +380,11 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator size is changed accordingly - indicatorHeight = indicator.GetCurrentSize().y; + indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 400.0f, TEST_LOCATION ); // Check that the indicator position goes back to the beginning of the scroll bar - indicatorPosition = indicator.GetCurrentPosition().y; + indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, 0.0f, TEST_LOCATION ); // Set the scroll position to one fifth of the maximum @@ -376,7 +395,7 @@ int UtcDaliToolkitScrollBarSetScrollPropertySourceP(void) application.Render(); // Check that the indicator should be in one fifth from the beginning of the scroll bar - indicatorPosition = indicator.GetCurrentPosition().y; + indicatorPosition = indicator.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y; DALI_TEST_EQUALS( indicatorPosition, (scrollBarHeight - indicatorHeight) * 0.2f, TEST_LOCATION ); END_TEST; @@ -417,6 +436,11 @@ int UtcDaliToolkitScrollBarSetScrollIndicatorP(void) DALI_TEST_CHECK( indicator != scrollBar.GetScrollIndicator() ); DALI_TEST_CHECK( newIndicator == scrollBar.GetScrollIndicator() ); + // Check that the new control indicator is successfully set + Control controlIndicator = Control::New(); + scrollBar.SetScrollIndicator(controlIndicator); + + DALI_TEST_CHECK( controlIndicator == Control::DownCast( scrollBar.GetScrollIndicator() ) ); END_TEST; } @@ -495,9 +519,9 @@ int UtcDaliToolkitScrollBarSetScrollPositionIntervalsP(void) ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical); DALI_TEST_CHECK( scrollBar ); - scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - scrollBar.SetSize(20.0f, 800.0f, 0.0f); + scrollBar.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); @@ -639,6 +663,20 @@ int UtcDaliToolkitScrollBarGetScrollPositionIntervalsP(void) DALI_TEST_EQUALS( positionIntervals[8], results[8], TEST_LOCATION ); DALI_TEST_EQUALS( positionIntervals[9], results[9], TEST_LOCATION ); + Property::Array resultArray = scrollBar.GetProperty(Toolkit::ScrollBar::Property::SCROLL_POSITION_INTERVALS); + + DALI_TEST_EQUALS( positionIntervals.Count(), resultArray.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[0], resultArray[0].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[1], resultArray[1].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[2], resultArray[2].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[3], resultArray[3].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[4], resultArray[4].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[5], resultArray[5].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[6], resultArray[6].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[7], resultArray[7].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[8], resultArray[8].Get(), TEST_LOCATION ); + DALI_TEST_EQUALS( positionIntervals[9], resultArray[9].Get(), TEST_LOCATION ); + END_TEST; } @@ -667,7 +705,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void) DALI_TEST_CHECK( scrollBar ); float scrollBarHeight = 100.0f; - scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); // Create a source actor that owns the scroll properties required by the scroll bar @@ -697,30 +735,35 @@ int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void) // Check that the indicator size should be: scroll bar size * (scroll bar size / content size). // i.e. The bigger the content size, the smaller the indicator size - float indicatorHeight = indicator.GetCurrentSize().y; + float indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION ); // Set the indicator height to be fixed to 50.0f scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed); scrollBar.SetIndicatorFixedHeight(50.0f); + Property::Value value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY); + DALI_TEST_EQUALS(value.Get(), "Fixed", TEST_LOCATION ); + // Render and notify application.SendNotification(); application.Render(); // Check that the indicator size should be 50.0f - indicatorHeight = indicator.GetCurrentSize().y; + indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, 50.0f, TEST_LOCATION ); // Set the indicator height to be variable scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable); + value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY); + DALI_TEST_EQUALS(value.Get(), "Variable", TEST_LOCATION ); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator size should be: scroll bar size * (scroll bar size / content size). - indicatorHeight = indicator.GetCurrentSize().y; + indicatorHeight = indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y; DALI_TEST_EQUALS( indicatorHeight, scrollBarHeight * scrollBarHeight / 500.0f, TEST_LOCATION ); END_TEST; @@ -754,7 +797,7 @@ int UtcDaliToolkitScrollBarSetIndicatorFixedHeightP(void) DALI_TEST_CHECK( scrollBar ); float scrollBarHeight = 100.0f; - scrollBar.SetSize(20.0f, scrollBarHeight, 0.0f); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, scrollBarHeight, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); Actor indicator = scrollBar.GetScrollIndicator(); @@ -769,7 +812,7 @@ int UtcDaliToolkitScrollBarSetIndicatorFixedHeightP(void) application.Render(); // Check that the indicator size should be 50.0f - DALI_TEST_EQUALS( indicator.GetCurrentSize().y, 50.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, 50.0f, TEST_LOCATION ); // Set the indicator height to be fixed to 25.0f scrollBar.SetIndicatorFixedHeight(25.0f); @@ -779,7 +822,7 @@ int UtcDaliToolkitScrollBarSetIndicatorFixedHeightP(void) application.Render(); // Check that the indicator size should be 25.0f - DALI_TEST_EQUALS( indicator.GetCurrentSize().y, 25.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, 25.0f, TEST_LOCATION ); END_TEST; } @@ -825,14 +868,14 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void) DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.35f, TEST_LOCATION ); // Make the indicator invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Show the indicator scrollBar.ShowIndicator(); @@ -845,21 +888,21 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void) application.Render(); // Check that the indicator is now visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Set the duration to show the indicator to be 0.75 second scrollBar.SetIndicatorShowDuration(0.75); DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), 0.75f, TEST_LOCATION ); // Make the indicator invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Show the indicator scrollBar.ShowIndicator(); @@ -872,7 +915,7 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void) application.Render(); // Check that the indicator is not fully visible yet - DALI_TEST_CHECK( indicator.GetCurrentOpacity() != 1.0f ); + DALI_TEST_CHECK( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ) != 1.0f ); // Wait for another 0.4 second Wait(application, 400); @@ -882,7 +925,7 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationP(void) application.Render(); // Check that the indicator is now fully visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); END_TEST; } @@ -907,14 +950,14 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationN(void) DALI_TEST_CHECK( duration > 0.0f ); // Make the indicator invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Show the indicator scrollBar.ShowIndicator(); @@ -927,21 +970,21 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationN(void) application.Render(); // Check that the indicator is now visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Now set the duration to show the indicator to be a negative value (which should be ignored and therefore means instant) scrollBar.SetIndicatorShowDuration(-0.25f); DALI_TEST_EQUALS( scrollBar.GetIndicatorShowDuration(), -0.25f, TEST_LOCATION ); // Make the indicator invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Show the indicator scrollBar.ShowIndicator(); @@ -951,7 +994,7 @@ int UtcDaliToolkitScrollBarSetIndicatorShowDurationN(void) application.Render(); // Check that the indicator becomes instantly visible in the next frame - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); END_TEST; } @@ -997,14 +1040,14 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void) DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.15f, TEST_LOCATION ); // Make the indicator visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Hide the indicator scrollBar.HideIndicator(); @@ -1017,21 +1060,21 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void) application.Render(); // Check that the indicator is now invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Set the duration to hide the indicator to be 0.65 second scrollBar.SetIndicatorHideDuration(0.65f); DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), 0.65f, TEST_LOCATION ); // Make the indicator visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Hide the indicator scrollBar.HideIndicator(); @@ -1044,7 +1087,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void) application.Render(); // Check that the indicator is not fully invisible yet - DALI_TEST_CHECK( indicator.GetCurrentOpacity() != 0.0f ); + DALI_TEST_CHECK( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ) != 0.0f ); // Wait for another 0.5 second Wait(application, 500); @@ -1054,7 +1097,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationP(void) application.Render(); // Check that the indicator is now fully invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); END_TEST; } @@ -1079,14 +1122,14 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationN(void) DALI_TEST_CHECK( duration > 0.0f ); // Make the indicator visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Hide the indicator scrollBar.HideIndicator(); @@ -1099,21 +1142,21 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationN(void) application.Render(); // Check that the indicator is now invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Now set the duration to hide the indicator to be a negative value (which should be ignored and therefore means instant) scrollBar.SetIndicatorHideDuration(-0.25f); DALI_TEST_EQUALS( scrollBar.GetIndicatorHideDuration(), -0.25f, TEST_LOCATION ); // Make the indicator visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Hide the indicator scrollBar.HideIndicator(); @@ -1123,7 +1166,7 @@ int UtcDaliToolkitScrollBarSetIndicatorHideDurationN(void) application.Render(); // Check that the indicator becomes instantly invisible in the next frame - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); END_TEST; } @@ -1171,14 +1214,14 @@ int UtcDaliToolkitScrollBarShowIndicatorP(void) DALI_TEST_CHECK( duration > 0.0f ); // Make the indicator invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Show the indicator scrollBar.ShowIndicator(); @@ -1191,7 +1234,7 @@ int UtcDaliToolkitScrollBarShowIndicatorP(void) application.Render(); // Check that the indicator is now visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); END_TEST; } @@ -1210,14 +1253,14 @@ int UtcDaliToolkitScrollBarShowIndicatorN(void) DALI_TEST_CHECK( indicator ); // Make the indicator initially visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is initially visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Get the default duration to show the indicator float duration = scrollBar.GetIndicatorShowDuration(); @@ -1233,7 +1276,7 @@ int UtcDaliToolkitScrollBarShowIndicatorN(void) application.Render(); // Check that the indicator is still visible in the very next frame - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); END_TEST; } @@ -1258,14 +1301,14 @@ int UtcDaliToolkitScrollBarHideIndicatorP(void) DALI_TEST_CHECK( duration > 0.0f ); // Make the indicator visible - indicator.SetOpacity(1.0f); + indicator.SetProperty( Actor::Property::OPACITY,1.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is visible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); // Hide the indicator scrollBar.HideIndicator(); @@ -1278,7 +1321,7 @@ int UtcDaliToolkitScrollBarHideIndicatorP(void) application.Render(); // Check that the indicator is now invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); END_TEST; } @@ -1297,14 +1340,14 @@ int UtcDaliToolkitScrollBarHideIndicatorN(void) DALI_TEST_CHECK( indicator ); // Make the indicator initially invisible - indicator.SetOpacity(0.0f); + indicator.SetProperty( Actor::Property::OPACITY,0.0f); // Render and notify application.SendNotification(); application.Render(); // Check that the indicator is initially invisible - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); // Get the default duration to hide the indicator float duration = scrollBar.GetIndicatorHideDuration(); @@ -1320,7 +1363,308 @@ int UtcDaliToolkitScrollBarHideIndicatorN(void) application.Render(); // Check that the indicator is still invisible in the very next frame - DALI_TEST_EQUALS( indicator.GetCurrentOpacity(), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarActionShowIndicator(void) +{ + ToolkitTestApplication application; + + // Create a scroll bar + ScrollBar scrollBar = ScrollBar::New(); + DALI_TEST_CHECK( scrollBar ); + + Stage::GetCurrent().Add( scrollBar ); + + Actor indicator = scrollBar.GetScrollIndicator(); + DALI_TEST_CHECK( indicator ); + + // Get the default duration to hide the indicator + float duration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION ); + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( duration > 0.0f ); + + // Make the indicator invisible + indicator.SetProperty( Actor::Property::OPACITY,0.0f); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + // Do the "ShowIndicator" action + Property::Map emptyMap; + scrollBar.DoAction( "ShowIndicator", emptyMap ); + + // Wait for the specified duration + Wait(application, duration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarActionHideIndicator(void) +{ + ToolkitTestApplication application; + + // Create a scroll bar + ScrollBar scrollBar = ScrollBar::New(); + DALI_TEST_CHECK( scrollBar ); + + Stage::GetCurrent().Add( scrollBar ); + + Actor indicator = scrollBar.GetScrollIndicator(); + DALI_TEST_CHECK( indicator ); + + // Get the default duration to hide the indicator + float duration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_HIDE_DURATION ); + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( duration > 0.0f ); + + // Make the indicator visible + indicator.SetProperty( Actor::Property::OPACITY,1.0f); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + // Do the "HideIndicator" action + Property::Map emptyMap; + scrollBar.DoAction( "HideIndicator", emptyMap ); + + // Wait for the specified duration + Wait(application, duration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarActionShowTransientIndicator(void) +{ + ToolkitTestApplication application; + + // Create a scroll bar + ScrollBar scrollBar = ScrollBar::New(); + DALI_TEST_CHECK( scrollBar ); + + Stage::GetCurrent().Add( scrollBar ); + + Actor indicator = scrollBar.GetScrollIndicator(); + DALI_TEST_CHECK( indicator ); + + // Get the default duration to hide the indicator + float duration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION ); + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( duration > 0.0f ); + + // Make the indicator invisible + indicator.SetProperty( Actor::Property::OPACITY,0.0f); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + // Do the "ShowIndicator" action + Property::Map emptyMap; + scrollBar.DoAction( "ShowTransientIndicator", emptyMap ); + + // Wait for the specified duration + Wait(application, duration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + // Get the default duration to hide the indicator + float hideDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_HIDE_DURATION ); + float transientDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_TRANSIENT_DURATION ); + float totalVisibleDuration = hideDuration + transientDuration; + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( totalVisibleDuration > 0.0f ); + + // Wait for the specified duration + Wait(application, totalVisibleDuration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarActionShowTransientIndicatorImmediate(void) +{ + ToolkitTestApplication application; + + // Create a scroll bar + ScrollBar scrollBar = ScrollBar::New(); + DALI_TEST_CHECK( scrollBar ); + + Stage::GetCurrent().Add( scrollBar ); + + Actor indicator = scrollBar.GetScrollIndicator(); + DALI_TEST_CHECK( indicator ); + + // Make the indicator invisible + indicator.SetProperty( Actor::Property::OPACITY,0.0f); + + // Don't use a show animation; the indicator should appear immediately + scrollBar.SetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION, 0.0f ); + float duration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION ); + DALI_TEST_EQUALS( duration, 0.0f, TEST_LOCATION ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Do the "ShowIndicator" action + Property::Map emptyMap; + scrollBar.DoAction( "ShowTransientIndicator", emptyMap ); + + // Wait for the specified duration + Wait(application); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + // Get the default duration to hide the indicator + float hideDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_HIDE_DURATION ); + float transientDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_TRANSIENT_DURATION ); + float totalVisibleDuration = hideDuration + transientDuration; + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( totalVisibleDuration > 0.0f ); + + // Wait for the specified duration + Wait(application, totalVisibleDuration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitScrollBarActionShowTransientIndicatorDuringHide(void) +{ + ToolkitTestApplication application; + + // Create a scroll bar + ScrollBar scrollBar = ScrollBar::New(); + DALI_TEST_CHECK( scrollBar ); + + Stage::GetCurrent().Add( scrollBar ); + + Actor indicator = scrollBar.GetScrollIndicator(); + DALI_TEST_CHECK( indicator ); + + // Get the default duration to hide the indicator + float duration = scrollBar.GetIndicatorHideDuration(); + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( duration > 0.0f ); + + // Make the indicator visible + indicator.SetProperty( Actor::Property::OPACITY,1.0f); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + // Hide the indicator + scrollBar.HideIndicator(); + + // Wait for half the specified duration + Wait(application, duration * 0.5f * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now partially hidden + DALI_TEST_CHECK( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ) < 1.0f ); + + // Now interrupt the Hide with a DoAction( "ShowTransientIndicator" ) + + // Get the default duration to hide the indicator + duration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_SHOW_DURATION ); + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( duration > 0.0f ); + + // Do the "ShowIndicator" action + Property::Map emptyMap; + scrollBar.DoAction( "ShowTransientIndicator", emptyMap ); + + // Wait for the specified duration + Wait(application, duration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now visible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + + // Get the default duration to hide the indicator + float hideDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_HIDE_DURATION ); + float transientDuration = scrollBar.GetProperty( ScrollBar::Property::INDICATOR_TRANSIENT_DURATION ); + float totalVisibleDuration = hideDuration + transientDuration; + + // Check that the default duration is greater than 0 + DALI_TEST_CHECK( totalVisibleDuration > 0.0f ); + + // Wait for the specified duration + Wait(application, totalVisibleDuration * 1000); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Check that the indicator is now invisible + DALI_TEST_EQUALS( indicator.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); END_TEST; } @@ -1333,9 +1677,9 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void) ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical); DALI_TEST_CHECK( scrollBar ); - scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - scrollBar.SetSize(20.0f, 800.0f, 0.0f); + scrollBar.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) ); // Set the indicator height to be fixed to 50.0f scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed); @@ -1344,7 +1688,10 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void) Stage::GetCurrent().Add( scrollBar ); // Connect the pan finished signal + ConnectionTracker connectionTracker; + bool panFinished = false; scrollBar.PanFinishedSignal().Connect( &OnPanFinished ); + scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished)); // Render and notify application.SendNotification(); @@ -1373,8 +1720,9 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void) application.Render(); // Perform a swipe gesture on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 1, 500); DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION ); END_TEST; } @@ -1387,9 +1735,9 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void) ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical); DALI_TEST_CHECK( scrollBar ); - scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - scrollBar.SetSize(20.0f, 800.0f, 0.0f); + scrollBar.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) ); // Set the indicator height to be fixed to 50.0f scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed); @@ -1398,14 +1746,17 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void) Stage::GetCurrent().Add( scrollBar ); // Connect the pan finished signal + ConnectionTracker connectionTracker; + bool panFinished = false; scrollBar.PanFinishedSignal().Connect( &OnPanFinished ); + scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished)); // Render and notify application.SendNotification(); application.Render(); // Perform a vertical swipe gesture on the indicator when there is no source object set on the scroll bar - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 500); DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION ); // Create a source actor that owns the scroll properties required by the scroll bar @@ -1431,12 +1782,14 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void) application.Render(); // Perform a swipe gesture on the scroll bar but not on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20, 2000); DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION ); // Perform a swipe gesture on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 4000); DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION ); END_TEST; } @@ -1449,14 +1802,17 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void) ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical); DALI_TEST_CHECK( scrollBar ); - scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - scrollBar.SetSize(20.0f, 800.0f, 0.0f); + scrollBar.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); + ConnectionTracker connectionTracker; // Connect to the ScrollPositionIntervalReached signal + bool intervalReached = false; scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached ); + scrollBar.ConnectSignal( &connectionTracker, "scrollPositionIntervalReached", CallbackFunctor(&intervalReached)); // Render and notify application.SendNotification(); @@ -1509,9 +1865,11 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void) // Check that the signal callback is called DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION ); // Reset the flag gOnScrollPositionIntervalReachedSignalCalled = false; + intervalReached = false; // Rest and clear the animation animation.Clear(); @@ -1527,9 +1885,11 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void) // Check that the signal callback is called DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION ); // Reset the flag gOnScrollPositionIntervalReachedSignalCalled = false; + intervalReached = false; // Rest and clear the animation animation.Clear(); @@ -1545,6 +1905,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void) // Check that the signal callback is called DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION ); END_TEST; } @@ -1557,9 +1918,9 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void) ScrollBar scrollBar = ScrollBar::New(ScrollBar::Vertical); DALI_TEST_CHECK( scrollBar ); - scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - scrollBar.SetSize(20.0f, 800.0f, 0.0f); + scrollBar.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + scrollBar.SetProperty( Actor::Property::SIZE, Vector3(20.0f, 800.0f, 0.0f) ); Stage::GetCurrent().Add( scrollBar ); @@ -1635,5 +1996,3 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void) END_TEST; } - -