Added IGNORE_SPACES_AFTER_TEXT property
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / dali-toolkit-test-utils / toolkit-text-utils.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 74ac7b5..24ff3f7
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -109,7 +109,8 @@ void CreateTextModel( const std::string& text,
   Vector<Character>& utf32Characters = logicalModel->mText;
   utf32Characters.Resize( text.size() );
 
-  const uint32_t numberOfCharacters = Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( text.c_str() ),
+  const uint32_t numberOfCharacters = ( text.size() == 0) ? 0 :
+    Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( text.c_str() ),
                                                    text.size(),
                                                    &utf32Characters[0u] );
   utf32Characters.Resize( numberOfCharacters );
@@ -269,7 +270,7 @@ void CreateTextModel( const std::string& text,
   // Set the layout parameters.
   const Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;
   const Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;
-
+  float outlineWidth = visualModel->GetOutlineWidth();
   Layout::Parameters layoutParameters( textArea,
                                        utf32Characters.Begin(),
                                        lineBreakInfo.Begin(),
@@ -281,7 +282,10 @@ void CreateTextModel( const std::string& text,
                                        charactersToGlyph.Begin(),
                                        glyphsPerCharacter.Begin(),
                                        numberOfGlyphs,
-                                       Layout::HORIZONTAL_ALIGN_BEGIN );
+                                       Text::HorizontalAlignment::BEGIN,
+                                       Text::LineWrap::WORD,
+                                       outlineWidth,
+                                       true );
 
   Vector<LineRun>& lines = visualModel->mLines;
 
@@ -338,7 +342,7 @@ void CreateTextModel( const std::string& text,
     layoutEngine.Align( textArea,
                         0u,
                         numberOfCharacters,
-                        Layout::HORIZONTAL_ALIGN_BEGIN,
+                        Text::HorizontalAlignment::BEGIN,
                         lines,
                         alignmentOffset );
   }
@@ -355,8 +359,9 @@ void ConfigureTextLabel( ControllerPtr controller )
   // Set cursor's width to zero.
   controller->GetLayoutEngine().SetCursorWidth( 0 );
 
+  InputMethodContext inputMethodContext = InputMethodContext::New();
   // Disables the text input.
-  controller->EnableTextInput( NULL );
+  controller->EnableTextInput( NULL, inputMethodContext );
 
   // Disables the vertical scrolling.
   controller->SetVerticalScrollEnabled( false );
@@ -380,8 +385,9 @@ void ConfigureTextField( ControllerPtr controller )
   // Set the text layout as multi-line.
   controller->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
 
+  InputMethodContext inputMethodContext = InputMethodContext::New();
   // Enables the text input.
-  controller->EnableTextInput( decorator );
+  controller->EnableTextInput( decorator, inputMethodContext );
 
   // Enables the vertical scrolling after the text input has been enabled.
   controller->SetVerticalScrollEnabled( false );
@@ -408,8 +414,9 @@ void ConfigureTextEditor( ControllerPtr controller )
   // Set the text layout as multi-line.
   controller->GetLayoutEngine().SetLayout( Layout::Engine::MULTI_LINE_BOX );
 
+  InputMethodContext inputMethodContext = InputMethodContext::New();
   // Enables the text input.
-  controller->EnableTextInput( decorator );
+  controller->EnableTextInput( decorator, inputMethodContext );
 
   // Enables the vertical scrolling after the text input has been enabled.
   controller->SetVerticalScrollEnabled( true );