X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Fdali-toolkit-test-utils%2Ftoolkit-text-utils.cpp;h=701977d80d9473f07dd19e4cf68192a9bf198385;hp=0a426b01fd5bd9e27fea41cc27206d1d5a2cb5ab;hb=4800a84a19c2fd33aea3174eae8e55297ee3a9af;hpb=9161d9828d1a5bb3c7eaf83002863de84b23b751 diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp index 0a426b0..701977d 100755 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp @@ -102,7 +102,9 @@ void CreateTextModel( const std::string& text, ModelPtr& textModel, MetricsPtr& metrics, bool markupProcessorEnabled, - LineWrap::Mode wrapMode ) + LineWrap::Mode wrapMode, + bool ellipsisEnabled, + DevelText::EllipsisPosition::Type ellipsisPosition) { textModel = Model::New(); ///< Pointer to the text's model. LogicalModelPtr logicalModel = textModel->mLogicalModel; @@ -112,7 +114,8 @@ void CreateTextModel( const std::string& text, logicalModel->mFontDescriptionRuns, logicalModel->mEmbeddedItems, logicalModel->mAnchors, - logicalModel->mUnderlinedCharacterRuns); + logicalModel->mUnderlinedCharacterRuns, + logicalModel->mBackgroundColorRuns); Length textSize = 0u; const uint8_t* utf8 = NULL; @@ -132,6 +135,12 @@ void CreateTextModel( const std::string& text, utf8 = reinterpret_cast( text.c_str() ); } + //Ellipsis + textModel-> mElideEnabled = ellipsisEnabled; + textModel-> mVisualModel->SetTextElideEnabled(ellipsisEnabled); + textModel-> mEllipsisPosition = ellipsisPosition; + textModel-> mVisualModel->SetEllipsisPosition(ellipsisPosition); + // 1) Convert to utf32 Vector& utf32Characters = logicalModel->mText; utf32Characters.Resize( textSize ); @@ -322,7 +331,6 @@ void CreateTextModel( const std::string& text, // Set the layout parameters. textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN; textModel->mIgnoreSpacesAfterText = true; - textModel->mMatchSystemLanguageDirection = false; Layout::Parameters layoutParameters( textArea, textModel ); @@ -343,7 +351,8 @@ void CreateTextModel( const std::string& text, layoutEngine.LayoutText( layoutParameters, layoutSize, false, - isAutoScroll ); + isAutoScroll, + ellipsisPosition); if( options.align ) { @@ -382,6 +391,9 @@ void ConfigureTextLabel( ControllerPtr controller ) // Enable the text elide. controller->SetTextElideEnabled( true ); + + // Disable match system language direction + controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS); } void ConfigureTextField( ControllerPtr controller ) @@ -411,6 +423,9 @@ void ConfigureTextField( ControllerPtr controller ) // Disable the text elide. controller->SetTextElideEnabled( false ); + + // Disable match system language direction + controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS); } void ConfigureTextEditor( ControllerPtr controller ) @@ -440,6 +455,50 @@ void ConfigureTextEditor( ControllerPtr controller ) // Disable the text elide. controller->SetTextElideEnabled( false ); + + // Disable match system language direction + controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS); +} + + +Vector CreateSingleFontDescription( + const CharacterRun& characterRun, + const std::string fontFamilyName, + const FontWeight weight, + const FontWidth width, + const FontSlant slant, + const PointSize26Dot6 size, + const bool familyDefined, + const bool weightDefined, + const bool widthDefined, + const bool slantDefined, + const bool sizeDefined) +{ + + FontDescriptionRun fontDescriptionRun = + { + characterRun, + nullptr, + 0u, + weight, + width, + slant, + size, + familyDefined, + weightDefined, + widthDefined, + slantDefined, + sizeDefined + }; + + fontDescriptionRun.familyLength = fontFamilyName.size(); + fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength]; + memcpy( fontDescriptionRun.familyName, fontFamilyName.c_str(), fontDescriptionRun.familyLength ); + + Vector fontDescriptionRuns; + fontDescriptionRuns.PushBack(fontDescriptionRun); + + return fontDescriptionRuns; } } // namespace Text