Fixed an incorrect ellipsis
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-Text-ViewModel.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 422e6ac..fc87193
@@ -71,6 +71,7 @@ struct ElideData
   unsigned int numberOfLines;
   unsigned int numberOfGlyphs;
   float*       positions;
+  unsigned int ignoreOfGlyphs;
 };
 
 bool ElideTest( const ElideData& data )
@@ -130,7 +131,7 @@ bool ElideTest( const ElideData& data )
   if( numberOfLines != 0u )
   {
     const LineRun& lastLine = *( model->GetLines() + numberOfLines - 1u );
-    const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex;
+    const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex + data.ignoreOfGlyphs;
 
     std::cout << "  last line alignment offset : " << lastLine.alignmentOffset << std::endl;
 
@@ -307,14 +308,14 @@ int UtcDaliTextViewModelGetAlignment(void)
   ViewModel* model = typesetter->GetViewModel();
   DALI_TEST_CHECK( NULL != model );
 
-  DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION );
-  DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_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( Layout::HORIZONTAL_ALIGN_CENTER );
-  controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER );
+  controller->SetHorizontalAlignment( Text::HorizontalAlignment::CENTER );
+  controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER );
 
-  DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_CENTER, model->GetHorizontalAlignment(), TEST_LOCATION );
-  DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_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;
@@ -583,17 +584,20 @@ int UtcDaliTextViewModelElideText02(void)
   Size textSize00( 100.f, 100.f );
 
   Size textSize01( 80.f, 100.f );
-  float positions01[] = { 0.f, 10.f, 16.f, 26.f, 35.f, 38.f, 46.f, 56.f };
+  float positions01[] = { 0.f, 9.f, 17.f, 27.f, 35.f, 37.f, 46.f, 56.f };
 
   Size textSize02( 80.f, 100.f );
   float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 11.f };
 
   Size textSize03( 80.f, 100.f );
-  float positions03[] = { 77.f, 76.f, 71.f, 62.f, 60.f, 52.f, 47.f, 42.f, 39.f, 35.f, 32.f, 13.f };
+  float positions03[] = { 77.f, 76.f, 71.f, 62.f, 59.f, 52.f, 47.f, 42.f, 39.f, 35.f, 32.f, 13.f };
 
   Size textSize04( 80.f, 10.f );
   float positions04[] = { 2.f };
 
+  Size textSize05( 180.f, 100.f );
+  float positions05[] = { 0.f, 0.f };
+
   struct ElideData data[] =
   {
     {
@@ -602,7 +606,8 @@ int UtcDaliTextViewModelElideText02(void)
       textSize00,
       0u,
       0u,
-      NULL
+      NULL,
+      0u
     },
     {
       "Latin script",
@@ -610,7 +615,8 @@ int UtcDaliTextViewModelElideText02(void)
       textSize01,
       5u,
       42u,
-      positions01
+      positions01,
+      0u
     },
     {
       "Hebrew script",
@@ -618,7 +624,8 @@ int UtcDaliTextViewModelElideText02(void)
       textSize02,
       5u,
       49u,
-      positions02
+      positions02,
+      0u
     },
     {
       "Arabic script",
@@ -626,7 +633,8 @@ int UtcDaliTextViewModelElideText02(void)
       textSize03,
       5u,
       79u,
-      positions03
+      positions03,
+      0u
     },
     {
       "Small control size, no line fits.",
@@ -634,10 +642,20 @@ int UtcDaliTextViewModelElideText02(void)
       textSize04,
       1u,
       1u,
-      positions04
-    }
+      positions04,
+      0u
+    },
+    {
+      "Include newline character",
+      "<font family='TizenSans'>yesterday\n all\n my troubles\n seemed so far\n\n away now it looks</font>",
+      textSize05,
+      5u,
+      40,
+      positions05,
+      5u
+    },
   };
-  const unsigned int numberOfTests = 5u;
+  const unsigned int numberOfTests = 6u;
 
   for( unsigned int index = 0u; index < numberOfTests; ++index )
   {