Text - Layout improvement.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-LogicalModel.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 9fe39c0..46dbc2f
@@ -22,7 +22,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/internal/text/text-run-container.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
 
 
 using namespace Dali;
@@ -100,8 +100,9 @@ struct GetLogicalCursorIndexData
 bool CreateParagraphTest( const CreateParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel = LogicalModel::New();
-  VisualModelPtr visualModel = VisualModel::New();
+  LogicalModelPtr logicalModel;
+  VisualModelPtr visualModel;
+  MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
 
@@ -113,7 +114,9 @@ bool CreateParagraphTest( const CreateParagraphData& data )
                    options,
                    layoutSize,
                    logicalModel,
-                   visualModel );
+                   visualModel,
+                   metrics,
+                   false );
 
   // 2) Clear the paragraphs.
   Vector<ParagraphRun>& paragraphs = logicalModel->mParagraphInfo;
@@ -158,8 +161,9 @@ bool CreateParagraphTest( const CreateParagraphData& data )
 bool FindParagraphTest( const FindParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel = LogicalModel::New();
-  VisualModelPtr visualModel = VisualModel::New();
+  LogicalModelPtr logicalModel;
+  VisualModelPtr visualModel;
+  MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
 
@@ -171,7 +175,9 @@ bool FindParagraphTest( const FindParagraphData& data )
                    options,
                    layoutSize,
                    logicalModel,
-                   visualModel );
+                   visualModel,
+                   metrics,
+                   false );
 
   // 2) Find the paragraphs.
   Vector<ParagraphRunIndex> paragraphs;
@@ -204,8 +210,9 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel = LogicalModel::New();
-  VisualModelPtr visualModel = VisualModel::New();
+  LogicalModelPtr logicalModel;
+  VisualModelPtr visualModel;
+  MetricsPtr metrics;
   Size textArea( 100.f, 300.f );
   Size layoutSize;
 
@@ -218,7 +225,9 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
                    options,
                    layoutSize,
                    logicalModel,
-                   visualModel );
+                   visualModel,
+                   metrics,
+                   false );
 
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
@@ -247,8 +256,9 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel = LogicalModel::New();
-  VisualModelPtr visualModel = VisualModel::New();
+  LogicalModelPtr logicalModel;
+  VisualModelPtr visualModel;
+  MetricsPtr metrics;
   Size layoutSize;
 
   // Create the model with the whole text.
@@ -260,7 +270,9 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
                    options,
                    layoutSize,
                    logicalModel,
-                   visualModel );
+                   visualModel,
+                   metrics,
+                   false );
 
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {
@@ -287,8 +299,9 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel = LogicalModel::New();
-  VisualModelPtr visualModel = VisualModel::New();
+  LogicalModelPtr logicalModel;
+  VisualModelPtr visualModel;
+  MetricsPtr metrics;
   Size layoutSize;
 
   // Create the model with the whole text.
@@ -300,7 +313,9 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
                    options,
                    layoutSize,
                    logicalModel,
-                   visualModel );
+                   visualModel,
+                   metrics,
+                   false );
 
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {
@@ -852,8 +867,8 @@ int UtcDaliGetLogicalCursorIndex(void)
   unsigned int characterIndex06[] = {  0u,  0u,  0u,  0u,  0u,  0u,  0u,  0u,  0u,  0u,  0u,
                                       12u, 12u, 12u, 12u, 12u, 12u };
 
-  unsigned int logicalIndex06[] = { 10u,  9u,  8u,  7u,  6u,  5u,  4u,  3u,  2u,  1u,  0u,
-                                    16u, 15u, 14u, 13u, 12u, 11u };
+  unsigned int logicalIndex06[] = { 11u, 10u,  9u,  8u,  7u,  6u,  5u,  4u,  3u,  2u,  1u,
+                                    13u, 16u, 15u, 14u, 13u, 12u };
 
   unsigned int bidirectionalLineIndex06[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                                               1u, 1u, 1u, 1u, 1u, 1u };