Fixing Bug: Caret is too big with LineSpacing
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-LogicalModel.cpp
index 67c7e24..8b15ad3 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -104,8 +104,7 @@ struct GetLogicalCursorIndexData
 bool CreateParagraphTest( const CreateParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -117,10 +116,16 @@ bool CreateParagraphTest( const CreateParagraphData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
-                   false );
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   // 2) Clear the paragraphs.
   Vector<ParagraphRun>& paragraphs = logicalModel->mParagraphInfo;
@@ -165,8 +170,7 @@ bool CreateParagraphTest( const CreateParagraphData& data )
 bool FindParagraphTest( const FindParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -178,10 +182,16 @@ bool FindParagraphTest( const FindParagraphData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
-                   false );
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   // 2) Find the paragraphs.
   Vector<ParagraphRunIndex> paragraphs;
@@ -214,8 +224,7 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea( 100.f, 300.f );
   Size layoutSize;
@@ -228,10 +237,16 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
-                   false );
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
@@ -260,8 +275,7 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -273,10 +287,16 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
-                   false );
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {
@@ -315,8 +335,7 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
 
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -335,10 +354,16 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
-                   false );
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {