[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-Text-ViewModel.cpp
old mode 100755 (executable)
new mode 100644 (file)
index b13fcda..dc3f714
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -15,9 +15,9 @@
  *
  */
 
-#include <iostream>
 #include <stdlib.h>
 #include <unistd.h>
+#include <iostream>
 
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
@@ -34,12 +34,12 @@ using namespace Text;
 
 namespace
 {
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
 
-const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
-
-const Size CONTROL_SIZE( 200.f, 400.f );
-const Size CONTROL_SMALL_SIZE( 50.f, 100.f );
-const char* LOREM_IPSUM = "Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.\n"
+const Size  CONTROL_SIZE(200.f, 400.f);
+const Size  CONTROL_SMALL_SIZE(50.f, 100.f);
+const char* LOREM_IPSUM =
+  "Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.\n"
   "Usu ne nisl maiorum iudicabit, veniam epicurei oporteat eos an.\n"
   "Ne nec nulla regione albucius, mea doctus delenit ad!\n"
   "Et everti blandit adversarium mei, eam porro neglegentur suscipiantur an.\n"
@@ -50,19 +50,21 @@ const char* LOREM_IPSUM = "Lorem ipsum dolor sit amet, aeque definiebas ea mei,
   "Aliquip sanctůs delicáta quí ěá, et natum aliquam est?\n"
   "Asšúm sapěret usu ůť.\n"
   "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n";
-const Vector2 LOREM_SCROLL_POSITION( 0.f, -265.f );
-const Length LOREM_NUMBER_OF_LINES = 35u;
-const Length LOREM_NUMBER_OF_LINES_ELIDED = 21u;
-const Length LOREM_NUMBER_OF_GLYPHS = 632;
-const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 393u;
+const Vector2 LOREM_SCROLL_POSITION(0.f, -265.f);
+const Length  LOREM_NUMBER_OF_LINES             = 35u;
+const Length  LOREM_NUMBER_OF_LINES_ELIDED      = 21u;
+const Length  LOREM_NUMBER_OF_GLYPHS            = 632u;
+const Length  LOREM_NUMBER_OF_GLYPHS_ELIDED     = 393u;
+const Length  LOREM_NUMBER_OF_CHARACTERS        = 633u;
+const Length  LOREM_NUMBER_OF_CHARACTERS_ELIDED = 633u;
 
 // The expected layout size for UtcDaliTextViewModelGetLayoutSize
-const Size LAYOUT_SIZE( 181.f, 48.f );
+const Size LAYOUT_SIZE(182.f, 48.f);
 
 // The expected color indices for UtcDaliTextViewModelGetColors
-const ColorIndex COLOR_INDICES[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u };
-const Length NUMBER_OF_COLORS = 3u;
-const Vector4 COLORS[] = { Color::RED, Color::BLUE, Color::GREEN };
+const ColorIndex COLOR_INDICES[]  = {0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u};
+const Length     NUMBER_OF_COLORS = 3u;
+const Vector4    COLORS[]         = {Color::RED, Color::BLUE, Color::GREEN};
 
 struct ElideData
 {
@@ -74,81 +76,81 @@ struct ElideData
   float*       positions;
 };
 
-bool ElideTest( const ElideData& data )
+bool ElideTest(const ElideData& data)
 {
   std::cout << "  testing : " << data.description << std::endl;
 
   // Load some fonts.
   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
-  fontClient.SetDpi( 93u, 93u );
+  fontClient.SetDpi(93u, 93u);
 
-  char* pathNamePtr = get_current_dir_name();
-  const std::string pathName( pathNamePtr );
-  free( pathNamePtr );
+  char*             pathNamePtr = get_current_dir_name();
+  const std::string pathName(pathNamePtr);
+  free(pathNamePtr);
 
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
+  fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
+  fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf");
+  fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf");
 
   // Creates a text controller.
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Sets a text and relais-out.
-  controller->SetMarkupProcessorEnabled( true );
+  controller->SetMarkupProcessorEnabled(true);
 
-  controller->SetText( data.text );
-  controller->Relayout( data.size );
+  controller->SetText(data.text);
+  controller->Relayout(data.size);
 
   // Elide the glyphs.
   model->ElideGlyphs();
 
-  if( data.numberOfLines != model->GetNumberOfLines() )
+  if(data.numberOfLines != model->GetNumberOfLines())
   {
     std::cout << "  different number of lines : " << model->GetNumberOfLines() << ", expected : " << data.numberOfLines << std::endl;
     return false;
   }
 
-  if( data.numberOfGlyphs != model->GetNumberOfGlyphs() )
+  if(data.numberOfGlyphs != model->GetNumberOfGlyphs())
   {
     std::cout << "  different number of glyphs : " << model->GetNumberOfGlyphs() << ", expected : " << data.numberOfGlyphs << std::endl;
     return false;
   }
 
-  const Vector2* const layoutBuffer = model->GetLayout();
-  const Length numberOfLines = model->GetNumberOfLines();
+  const Vector2* const layoutBuffer  = model->GetLayout();
+  const Length         numberOfLines = model->GetNumberOfLines();
 
-  if( numberOfLines != 0u )
+  if(numberOfLines != 0u)
   {
-    const LineRun& lastLine = *( model->GetLines() + numberOfLines - 1u );
-    const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex;
+    const LineRun& lastLine               = *(model->GetLines() + numberOfLines - 1u);
+    const Length   numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex;
 
     std::cout << "  last line alignment offset : " << floor(lastLine.alignmentOffset) << std::endl;
 
-    for( unsigned int index = 0u; index < numberOfLastLineGlyphs; ++index )
+    for(unsigned int index = 0u; index < numberOfLastLineGlyphs; ++index)
     {
-      if( *( data.positions + index ) != floor(lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + index ) ).x ) )
+      if(*(data.positions + index) != floor(lastLine.alignmentOffset + (*(layoutBuffer + lastLine.glyphRun.glyphIndex + index)).x))
       {
         std::cout << "  different layout :";
-        for( unsigned int i = 0; i < numberOfLastLineGlyphs; ++i )
+        for(unsigned int i = 0; i < numberOfLastLineGlyphs; ++i)
         {
-          std::cout << " " << floor( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + i ) ).x );
+          std::cout << " " << floor(lastLine.alignmentOffset + (*(layoutBuffer + lastLine.glyphRun.glyphIndex + i)).x);
         }
         std::cout << std::endl;
         std::cout << "          expected :";
-        for( unsigned int i = 0; i < numberOfLastLineGlyphs; ++i )
+        for(unsigned int i = 0; i < numberOfLastLineGlyphs; ++i)
         {
-          std::cout << " " << *( data.positions + i );
+          std::cout << " " << *(data.positions + i);
         }
         std::cout << std::endl;
         return false;
@@ -170,12 +172,12 @@ int UtcDaliTextViewModel(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -190,25 +192,25 @@ int UtcDaliTextViewModelGetControlSize(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // The text has not been laid-out. The stored control's size should be zero.
-  DALI_TEST_EQUALS( Size::ZERO, model->GetControlSize(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Size::ZERO, model->GetControlSize(), TEST_LOCATION);
 
   // Sets a text and relais-out.
-  controller->SetText( "Hello world" );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText("Hello world");
+  controller->Relayout(CONTROL_SIZE);
 
   // The control's size should be stored now.
-  DALI_TEST_EQUALS( CONTROL_SIZE, model->GetControlSize(), TEST_LOCATION );
+  DALI_TEST_EQUALS(CONTROL_SIZE, model->GetControlSize(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -221,38 +223,38 @@ int UtcDaliTextViewModelGetLayoutSize(void)
 
   // Load some fonts.
   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
-  fontClient.SetDpi( 93u, 93u );
+  fontClient.SetDpi(93u, 93u);
 
-  char* pathNamePtr = get_current_dir_name();
-  const std::string pathName( pathNamePtr );
-  free( pathNamePtr );
+  char*             pathNamePtr = get_current_dir_name();
+  const std::string pathName(pathNamePtr);
+  free(pathNamePtr);
 
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
+  fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
 
   // Creates a text controller.
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // The text has not been laid-out. The stored control's size should be zero.
-  DALI_TEST_EQUALS( Size::ZERO, model->GetLayoutSize(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Size::ZERO, model->GetLayoutSize(), TEST_LOCATION);
 
   // Sets a text and relais-out.
-  controller->SetMarkupProcessorEnabled( true );
-  controller->SetText( "<font family='TizenSansRegular' size='10'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>" );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetMarkupProcessorEnabled(true);
+  controller->SetText("<font family='TizenSansRegular' size='10'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>");
+  controller->Relayout(CONTROL_SIZE);
 
   // The control's size should be stored now.
-  DALI_TEST_EQUALS( LAYOUT_SIZE, model->GetLayoutSize(), TEST_LOCATION );
+  DALI_TEST_EQUALS(LAYOUT_SIZE, model->GetLayoutSize(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -267,26 +269,26 @@ int UtcDaliTextViewModelGetScrollPosition(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // No text has been set. The scroll position should be zero.
-  DALI_TEST_EQUALS( Vector2::ZERO, model->GetScrollPosition(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Vector2::ZERO, model->GetScrollPosition(), TEST_LOCATION);
 
   // Gains the keyboard focus, sets a big text and relais-out.
   controller->KeyboardFocusGainEvent();
-  controller->SetText( LOREM_IPSUM );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
 
   // The text should be scrolled to the end.
-  DALI_TEST_EQUALS( LOREM_SCROLL_POSITION, model->GetScrollPosition(), TEST_LOCATION );
+  DALI_TEST_EQUALS(LOREM_SCROLL_POSITION, model->GetScrollPosition(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -301,21 +303,21 @@ int UtcDaliTextViewModelGetAlignment(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
-  DALI_TEST_EQUALS( Text::HorizontalAlignment::BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION );
-  DALI_TEST_EQUALS( Text::VerticalAlignment::TOP, model->GetVerticalAlignment(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Text::HorizontalAlignment::BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION);
+  DALI_TEST_EQUALS(Text::VerticalAlignment::TOP, model->GetVerticalAlignment(), TEST_LOCATION);
 
-  controller->SetHorizontalAlignment( Text::HorizontalAlignment::CENTER );
-  controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER );
+  controller->SetHorizontalAlignment(Text::HorizontalAlignment::CENTER);
+  controller->SetVerticalAlignment(Text::VerticalAlignment::CENTER);
 
-  DALI_TEST_EQUALS( Text::HorizontalAlignment::CENTER, model->GetHorizontalAlignment(), TEST_LOCATION );
-  DALI_TEST_EQUALS( Text::VerticalAlignment::CENTER, model->GetVerticalAlignment(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Text::HorizontalAlignment::CENTER, model->GetHorizontalAlignment(), TEST_LOCATION);
+  DALI_TEST_EQUALS(Text::VerticalAlignment::CENTER, model->GetVerticalAlignment(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -330,24 +332,64 @@ int UtcDaliTextViewModelIsTextElideEnabled(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // Elide text should be disabled.
-  DALI_TEST_CHECK( !model->IsTextElideEnabled() );
+  DALI_TEST_CHECK(!model->IsTextElideEnabled());
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Elide text should be enabled.
-  DALI_TEST_CHECK( model->IsTextElideEnabled() );
+  DALI_TEST_CHECK(model->IsTextElideEnabled());
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
+
+int UtcDaliTextViewModelGetCharacters(void)
+{
+  tet_infoline(" UtcDaliTextViewModelGetLines");
+  ToolkitTestApplication application;
+
+  // Creates a text controller.
+  ControllerPtr controller = Controller::New();
+
+  // Tests the rendering controller has been created.
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
+
+  // Tests the view model has been created.
+  ViewModel* model = typesetter->GetViewModel();
+  DALI_TEST_CHECK(NULL != model);
+
+  // Configures the text controller similarly to the text-editor.
+  ConfigureTextEditor(controller);
+
+  // The number of characters should be zero.
+  DALI_TEST_EQUALS(0u, model->GetNumberOfCharacters(), TEST_LOCATION);
+
+  // Sets a text and relais-out.
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
+
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_CHARACTERS, model->GetNumberOfCharacters(), TEST_LOCATION);
+  // Configures the text controller similarly to the text-label.
+  ConfigureTextLabel(controller);
+
+  // Relais-out for the text-label configuration.
+  controller->Relayout(Size(100.f, 100.f)); // Change the size to force a relayout.
+  controller->Relayout(CONTROL_SIZE);
+
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_CHARACTERS_ELIDED, model->GetNumberOfCharacters(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -362,36 +404,36 @@ int UtcDaliTextViewModelGetLines(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // The number of lines should be zero.
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL == model->GetLines() );
+  DALI_TEST_EQUALS(0u, model->GetNumberOfLines(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL == model->GetLines());
 
   // Sets a text and relais-out.
-  controller->SetText( LOREM_IPSUM );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL != model->GetLines() );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL != model->GetLines());
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Relais-out for the text-label configuration.
-  controller->Relayout( Size( 100.f, 100.f) ); // Change the size to force a relayout.
-  controller->Relayout( CONTROL_SIZE );
+  controller->Relayout(Size(100.f, 100.f)); // Change the size to force a relayout.
+  controller->Relayout(CONTROL_SIZE);
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL != model->GetLines() );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL != model->GetLines());
 
   tet_result(TET_PASS);
   END_TEST;
@@ -406,42 +448,42 @@ int UtcDaliTextViewModelGetGlyphsLayout(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // The number of glyphs should be zero.
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL == model->GetGlyphs() );
-  DALI_TEST_CHECK( NULL == model->GetLayout() );
+  DALI_TEST_EQUALS(0u, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL == model->GetGlyphs());
+  DALI_TEST_CHECK(NULL == model->GetLayout());
 
   // Sets a text and relais-out.
-  controller->SetText( LOREM_IPSUM );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL != model->GetGlyphs() );
-  DALI_TEST_CHECK( NULL != model->GetLayout() );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL != model->GetGlyphs());
+  DALI_TEST_CHECK(NULL != model->GetLayout());
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Relais-out for the text-label configuration.
-  controller->Relayout( Size( 100.f, 100.f) ); // Change the size to force a relayout.
-  controller->Relayout( CONTROL_SIZE );
+  controller->Relayout(Size(100.f, 100.f)); // Change the size to force a relayout.
+  controller->Relayout(CONTROL_SIZE);
 
   // Elide the glyphs.
   model->ElideGlyphs();
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL != model->GetGlyphs() );
-  DALI_TEST_CHECK( NULL != model->GetLayout() );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL != model->GetGlyphs());
+  DALI_TEST_CHECK(NULL != model->GetLayout());
 
   tet_result(TET_PASS);
   END_TEST;
@@ -456,35 +498,35 @@ int UtcDaliTextViewModelGetColors(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Sets a text and relais-out.
-  controller->SetMarkupProcessorEnabled( true );
-  controller->SetText( "Lorem <color value='red'>ips<color value='blue'>um do</color>lor s<color value='green'>i</color>t a</color>met." );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetMarkupProcessorEnabled(true);
+  controller->SetText("Lorem <color value='red'>ips<color value='blue'>um do</color>lor s<color value='green'>i</color>t a</color>met.");
+  controller->Relayout(CONTROL_SIZE);
 
-  DALI_TEST_EQUALS( Color::BLACK, model->GetDefaultColor(), TEST_LOCATION );
+  DALI_TEST_EQUALS(Color::BLACK, model->GetDefaultColor(), TEST_LOCATION);
 
   const ColorIndex* const colorIndicesBuffer = model->GetColorIndices();
 
   const Length numberOfGlyphs = model->GetNumberOfGlyphs();
-  for( ColorIndex index = 0u; index < numberOfGlyphs; ++index )
+  for(ColorIndex index = 0u; index < numberOfGlyphs; ++index)
   {
-    DALI_TEST_EQUALS( COLOR_INDICES[index], *( colorIndicesBuffer + index ), TEST_LOCATION );
+    DALI_TEST_EQUALS(COLOR_INDICES[index], *(colorIndicesBuffer + index), TEST_LOCATION);
   }
 
   const Vector4* const colors = model->GetColors();
-  for( unsigned int index = 0u; index < NUMBER_OF_COLORS; ++index )
+  for(unsigned int index = 0u; index < NUMBER_OF_COLORS; ++index)
   {
-    DALI_TEST_EQUALS( COLORS[index], *( colors + index ), TEST_LOCATION );
+    DALI_TEST_EQUALS(COLORS[index], *(colors + index), TEST_LOCATION);
   }
 
   tet_result(TET_PASS);
@@ -500,96 +542,96 @@ int UtcDaliTextViewModelElideText01(void)
   ControllerPtr controller = Controller::New();
 
   // Tests the rendering controller has been created.
-  TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
-  DALI_TEST_CHECK( typesetter );
+  TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
+  DALI_TEST_CHECK(typesetter);
 
   // Tests the view model has been created.
   ViewModel* model = typesetter->GetViewModel();
-  DALI_TEST_CHECK( NULL != model );
+  DALI_TEST_CHECK(NULL != model);
 
   // Configures the text controller similarly to the text-editor.
-  ConfigureTextEditor( controller );
+  ConfigureTextEditor(controller);
 
   // The number of glyphs should be zero.
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
-  DALI_TEST_CHECK( NULL == model->GetGlyphs() );
-  DALI_TEST_CHECK( NULL == model->GetLayout() );
+  DALI_TEST_EQUALS(0u, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0u, model->GetNumberOfLines(), TEST_LOCATION);
+  DALI_TEST_CHECK(NULL == model->GetGlyphs());
+  DALI_TEST_CHECK(NULL == model->GetLayout());
 
   // Sets a text and relais-out.
-  controller->SetText( LOREM_IPSUM );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
 
   // Keep the pointers to the glyphs and layout.
   // As the text is not elided with this configuration, the pointers shoud be the same after calling the ElideGlyphs() method.
-  const GlyphInfo* const glyphsModel = model->GetGlyphs();
-  const Vector2* layoutsModel = model->GetLayout();
+  const GlyphInfo* const glyphsModel  = model->GetGlyphs();
+  const Vector2*         layoutsModel = model->GetLayout();
 
   // Elide the glyphs. Text shouldn't be elided with this configuration.
   model->ElideGlyphs();
 
-  DALI_TEST_CHECK( glyphsModel == model->GetGlyphs() );
-  DALI_TEST_CHECK( layoutsModel == model->GetLayout() );
+  DALI_TEST_CHECK(glyphsModel == model->GetGlyphs());
+  DALI_TEST_CHECK(layoutsModel == model->GetLayout());
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION);
 
   // Configures the text controller similarly to the text-label.
-  ConfigureTextLabel( controller );
+  ConfigureTextLabel(controller);
 
   // Clear the text and relais-out.
-  controller->SetText( "" );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText("");
+  controller->Relayout(CONTROL_SIZE);
 
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
+  DALI_TEST_EQUALS(0u, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(0u, model->GetNumberOfLines(), TEST_LOCATION);
 
   // Elide the glyphs. Should not add the ellipsis glyph.
   model->ElideGlyphs();
 
-  DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+  DALI_TEST_EQUALS(0u, model->GetNumberOfGlyphs(), TEST_LOCATION);
 
   // Sets a text that doesn't need to be elided.
-  controller->SetText( "Hello\n" );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText("Hello\n");
+  controller->Relayout(CONTROL_SIZE);
 
   // Elide the glyphs.
   model->ElideGlyphs();
 
-  DALI_TEST_EQUALS( 6u, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( 2u, model->GetNumberOfLines(), TEST_LOCATION );
+  DALI_TEST_EQUALS(6u, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(2u, model->GetNumberOfLines(), TEST_LOCATION);
 
   // Sets a text and relais-out.
-  controller->SetText( LOREM_IPSUM );
-  controller->Relayout( CONTROL_SIZE );
+  controller->SetText(LOREM_IPSUM);
+  controller->Relayout(CONTROL_SIZE);
 
   // Elide the glyphs.
   model->ElideGlyphs();
 
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION );
-  const GlyphInfo* const glyphs = model->GetGlyphs();
-  const Vector2* layouts = model->GetLayout();
-  DALI_TEST_CHECK( NULL != glyphs );
-  DALI_TEST_CHECK( NULL != layouts );
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION);
+  const GlyphInfo* const glyphs  = model->GetGlyphs();
+  const Vector2*         layouts = model->GetLayout();
+  DALI_TEST_CHECK(NULL != glyphs);
+  DALI_TEST_CHECK(NULL != layouts);
 
   // When the ellipsis is enabled, at least a glyph has to be rendered.
   // Even if the given width is too narrow for rendering an ellipsis glyph.
-  controller->SetText( "…" );
+  controller->SetText("…");
   Vector3 sizeEllipsis = controller->GetNaturalSize();
-  controller->SetText( "A" );
-  Vector3 sizeA = controller->GetNaturalSize();
-  float testWidth = sizeA.width < sizeEllipsis.width ? sizeA.width : sizeEllipsis.width - 1.0;
+  controller->SetText("A");
+  Vector3 sizeA     = controller->GetNaturalSize();
+  float   testWidth = sizeA.width < sizeEllipsis.width ? sizeA.width : sizeEllipsis.width - 1.0;
 
-  controller->SetText( "AB" );
+  controller->SetText("AB");
   Vector3 sizeAB = controller->GetNaturalSize();
 
-  controller->Relayout( Size(testWidth, sizeAB.height) );
+  controller->Relayout(Size(testWidth, sizeAB.height));
 
   // Elide the glyphs.
   model->ElideGlyphs();
-  DALI_TEST_EQUALS( 1u, model->GetNumberOfGlyphs(), TEST_LOCATION );
-  DALI_TEST_EQUALS( 1u, model->GetNumberOfLines(), TEST_LOCATION );
+  DALI_TEST_EQUALS(1u, model->GetNumberOfGlyphs(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, model->GetNumberOfLines(), TEST_LOCATION);
 
   tet_result(TET_PASS);
   END_TEST;
@@ -599,69 +641,58 @@ int UtcDaliTextViewModelElideText02(void)
 {
   tet_infoline(" UtcDaliTextViewModelElideText02");
 
-  Size textSize00( 100.f, 100.f );
+  Size textSize00(100.f, 100.f);
 
-  Size textSize01( 80.f, 100.f );
-  float positions01[] = { 0.f, 7.f, 16.f, 26.f, 33.f, 41.f, 45.f, 55.f, 64.0f };
+  Size  textSize01(80.f, 100.f);
+  float positions01[] = {0.0f, 8.0f, 16.0f, 26.0f, 34.0f, 42.0f, 46.0f, 56.0f, 64.0f};
 
-  Size textSize02( 80.f, 100.f );
-  float positions02[] = { 68.f, 62.f, 58.f, 50.f, 46.f, 42.f, 32.f, 24.f, 5.f };
+  Size  textSize02(80.f, 100.f);
+  float positions02[] = {69.0f, 63.0f, 59.0f, 51.0f, 47.0f, 43.0f, 34.0f, 26.0f, 7.0f};
 
-  Size textSize03( 80.f, 100.f );
-  float positions03[] = { 78.f, 72.f, 66.f, 62.f, 57.f, 50.f, 45.f, 41.f, 39.f, 33.f, 30.f, 24.f, 5.0f };
+  Size  textSize03(80.f, 100.f);
+  float positions03[] = {78.0f, 72.0f, 66.0f, 62.0f, 57.0f, 50.0f, 45.0f, 41.0f, 39.0f, 33.0f, 29.0f, 23.0f, 3.0f};
 
-  Size textSize04( 80.f, 10.f );
-  float positions04[] = { 1.f };
+  Size  textSize04(80.f, 10.f);
+  float positions04[] = {1.f};
 
   struct ElideData data[] =
-  {
-    {
-      "void text",
-      "",
-      textSize00,
-      0u,
-      0u,
-      NULL
-    },
-    {
-      "Latin script",
-      "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
-      textSize01,
-      5u,
-      36u,
-      positions01
-    },
     {
-      "Hebrew script",
-      "<font family='TizenSansHebrew'>צעד על לשון המלצת לאחרונה, אם לכאן שנורו סרבול מדע, קרן דת שפות להפוך.</font>",
-      textSize02,
-      5u,
-      44u,
-      positions02
-    },
-    {
-      "Arabic script",
-      "<font family='TizenSansArabic'>عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.</font>",
-      textSize03,
-      5u,
-      66u,
-      positions03
-    },
-    {
-      "Small control size, no line fits.",
-      "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
-      textSize04,
-      1u,
-      1u,
-      positions04
-    }
-  };
+      {"void text",
+       "",
+       textSize00,
+       0u,
+       0u,
+       NULL},
+      {"Latin script",
+       "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
+       textSize01,
+       5u,
+       36u,
+       positions01},
+      {"Hebrew script",
+       "<font family='TizenSansHebrew'>צעד על לשון המלצת לאחרונה, אם לכאן שנורו סרבול מדע, קרן דת שפות להפוך.</font>",
+       textSize02,
+       5u,
+       44u,
+       positions02},
+      {"Arabic script",
+       "<font family='TizenSansArabic'>عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.</font>",
+       textSize03,
+       5u,
+       66u,
+       positions03},
+      {"Small control size, no line fits.",
+       "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
+       textSize04,
+       1u,
+       1u,
+       positions04}};
   const unsigned int numberOfTests = 5u;
 
-  for( unsigned int index = 0u; index < numberOfTests; ++index )
+  for(unsigned int index = 0u; index < numberOfTests; ++index)
   {
     ToolkitTestApplication application;
-    if( !ElideTest( data[index] ) )
+    if(!ElideTest(data[index]))
     {
       tet_result(TET_FAIL);
     }