const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>();
DALI_TEST_CHECK(!enabled);
+
+ label.SetProperty(TextLabel::Property::MULTI_LINE, false);
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 1);
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 9999.0f);
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
+
+ try
+ {
+ // Render the text.
+ application.SendNotification();
+ application.Render(1000);
+
+ application.GetScene().Remove(label);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(!label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
+ application.GetScene().Add(label);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+
+ label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, (Toolkit::TextLabel::AutoScrollStopMode::Type)2); // invalid type
+ label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>());
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
END_TEST;
}
case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
{
const bool enableAutoScroll = value.Get<bool>();
+ impl.mLastAutoScrollEnabled = enableAutoScroll;
// If request to auto scroll is the same as current state then do nothing.
if(enableAutoScroll != impl.mController->IsAutoScrollEnabled())
{
{
if(impl.mTextScroller)
{
- impl.mTextScroller->StopScrolling(false);
+ impl.mTextScroller->StopScrolling();
}
}
// If request is enable (true) then start autoscroll as not already running
{
if(mTextScroller)
{
- mLastAutoScrollEnabled = mController->IsAutoScrollEnabled();
- mTextScroller->StopScrolling(true);
+ if(mLastAutoScrollEnabled && !mController->IsAutoScrollEnabled())
+ {
+ mLastAutoScrollEnabled = false;
+ }
+
+ const Toolkit::TextLabel::AutoScrollStopMode::Type stopMode = mTextScroller->GetStopMode();
+ mTextScroller->SetStopMode(Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE);
+ mTextScroller->StopScrolling();
+ mTextScroller->SetStopMode(stopMode);
}
Control::OnSceneDisconnection();
}
mStopMode = stopMode;
}
-void TextScroller::StopScrolling(bool immediate)
+void TextScroller::StopScrolling()
{
if(mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING)
{
- if(mStopMode == TextLabel::AutoScrollStopMode::IMMEDIATE || immediate)
+ switch(mStopMode)
{
- mScrollAnimation.Stop();
- mScrollerInterface.ScrollingFinished();
- }
- else if(mStopMode == TextLabel::AutoScrollStopMode::FINISH_LOOP)
- {
- mScrollAnimation.SetLoopCount(1); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
- }
- else
- {
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n");
+ case TextLabel::AutoScrollStopMode::IMMEDIATE:
+ {
+ mScrollAnimation.Stop();
+ mScrollerInterface.ScrollingFinished();
+ break;
+ }
+ case TextLabel::AutoScrollStopMode::FINISH_LOOP:
+ {
+ mScrollAnimation.SetLoopCount(1); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
+ break;
+ }
+ default:
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n");
+ }
}
}
else
/**
* @brief Stop the auto scrolling.
- * @param[in] immediate Stop scrolling immediately.
*/
- void StopScrolling(bool immediate);
+ void StopScrolling();
/**
* @brief Get the mode of scrolling stop