END_TEST;
}
+
+int UtcDaliTextControllerDirectionCoverage(void)
+{
+ tet_infoline(" UtcDaliTextControllerDirectionCoverage");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextLabel(controller);
+
+ controller->SetMatchSystemLanguageDirection( true );
+ controller->SetLayoutDirection( Dali::LayoutDirection::RIGHT_TO_LEFT );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ tet_result(TET_PASS);
+
+ END_TEST;
+}
mActiveLayer.SetPosition( padding.start, padding.top );
}
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize, layoutDirection );
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
mActiveLayer.SetPosition( padding.start, padding.top );
}
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize, layoutDirection );
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
mController->SetTextFitContentSize( contentSize );
}
- // Support Right-To-Left
- Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( Self().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
-
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize, layoutDirection );
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) )
|| mTextUpdateNeeded )
TextVisual::EnableRendererUpdate( mVisual );
// Support Right-To-Left of padding
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( Self().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection )
{
std::swap( padding.start, padding.end );
#include <cmath>
#include <memory.h>
#include <dali/public-api/adaptor-framework/key.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
#include <dali/devel-api/text-abstraction/font-client.h>
// public : Relayout.
-Controller::UpdateTextType Controller::Relayout( const Size& size, Dali::LayoutDirection::Type layoutDirection )
+Controller::UpdateTextType Controller::Relayout( const Size& size )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, mImpl->mIsAutoScrollEnabled ?"true":"false" );
mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
}
- if( mImpl->mModel->mMatchSystemLanguageDirection && mImpl->mLayoutDirection != layoutDirection )
+ if( mImpl->mModel->mMatchSystemLanguageDirection )
{
- // Clear the update info. This info will be set the next time the text is updated.
- mImpl->mTextUpdateInfo.mClearAll = true;
- // Apply modifications to the model
- // Shape the text again is needed because characters like '()[]{}' have to be mirrored and the glyphs generated again.
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
- GET_GLYPH_METRICS |
- SHAPE_TEXT |
- UPDATE_DIRECTION |
- LAYOUT |
- BIDI_INFO |
- REORDER );
- mImpl->mLayoutDirection = layoutDirection;
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( Dali::Stage::GetCurrent().GetRootLayer().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+
+ if( mImpl->mLayoutDirection != layoutDirection )
+ {
+ // Clear the update info. This info will be set the next time the text is updated.
+ mImpl->mTextUpdateInfo.mClearAll = true;
+ // Apply modifications to the model
+ // Shape the text again is needed because characters like '()[]{}' have to be mirrored and the glyphs generated again.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
+ GET_GLYPH_METRICS |
+ SHAPE_TEXT |
+ UPDATE_DIRECTION |
+ LAYOUT |
+ BIDI_INFO |
+ REORDER );
+ mImpl->mLayoutDirection = layoutDirection;
+ }
}
// Make sure the model is up-to-date before layouting.
*
* @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
* @param[in] size A the size of a bounding box to layout text within.
- * @param[in] layoutDirection The direction of the system language.
*
* @return Whether the text model or decorations were updated.
*/
- UpdateTextType Relayout( const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT );
+ UpdateTextType Relayout( const Size& size );
/**
* @brief Request a relayout using the ControlInterface.
return;
}
- Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( control.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
-
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( relayoutSize, layoutDirection );
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( relayoutSize );
if( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType )
|| mRendererUpdateNeeded )