Outline effect has been fixed to be not front cropped.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-Text-Layout.cpp
index 80c4631..b521976 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -157,6 +157,7 @@ bool LayoutTextTest( const LayoutTextData& data )
   engine.SetLayout( data.layout );
 
   const Length totalNumberOfGlyphs = visualModel->mGlyphs.Count();
+  float outlineWidth = visualModel->GetOutlineWidth();
 
   Layout::Parameters layoutParameters( data.textArea,
                                        logicalModel->mText.Begin(),
@@ -169,7 +170,9 @@ bool LayoutTextTest( const LayoutTextData& data )
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        totalNumberOfGlyphs,
-                                       Layout::HORIZONTAL_ALIGN_BEGIN );
+                                       Text::HorizontalAlignment::BEGIN,
+                                       Text::LineWrap::WORD,
+                                       outlineWidth );
 
   layoutParameters.isLastNewParagraph = isLastNewParagraph;
 
@@ -373,6 +376,7 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
   Layout::Engine engine;
   engine.SetMetrics( metrics );
 
+  float outlineWidth = visualModel->GetOutlineWidth();
   Layout::Parameters layoutParameters( data.textArea,
                                        logicalModel->mText.Begin(),
                                        logicalModel->mLineBreakInfo.Begin(),
@@ -384,7 +388,9 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        visualModel->mGlyphs.Count(),
-                                       Layout::HORIZONTAL_ALIGN_BEGIN  );
+                                       Text::HorizontalAlignment::BEGIN,
+                                       Text::LineWrap::WORD,
+                                       outlineWidth );
 
   layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
   layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
@@ -426,17 +432,17 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
 
 struct AlignData
 {
-  std::string                 description;
-  std::string                 text;
-  Size                        textArea;
-  unsigned int                numberOfFonts;
-  FontDescriptionRun*         fontDescriptions;
-  Layout::HorizontalAlignment horizontalAlignment;
-  Layout::VerticalAlignment   verticalAlignment;
-  unsigned int                startIndex;
-  unsigned int                numberOfCharacters;
-  unsigned int                numberOfLines;
-  float*                      lineOffsets;
+  std::string                       description;
+  std::string                       text;
+  Size                              textArea;
+  unsigned int                      numberOfFonts;
+  FontDescriptionRun*               fontDescriptions;
+  Text::HorizontalAlignment::Type   horizontalAlignment;
+  Text::VerticalAlignment::Type     verticalAlignment;
+  unsigned int                      startIndex;
+  unsigned int                      numberOfCharacters;
+  unsigned int                      numberOfLines;
+  float*                            lineOffsets;
 };
 
 bool AlignTest( const AlignData& data )
@@ -482,11 +488,13 @@ bool AlignTest( const AlignData& data )
   Layout::Engine engine;
   engine.SetMetrics( metrics );
 
+  float alignmentOffset = 0.f;
   engine.Align( data.textArea,
                 data.startIndex,
                 data.numberOfCharacters,
                 data.horizontalAlignment,
-                visualModel->mLines );
+                visualModel->mLines,
+                alignmentOffset );
 
   // Compare results.
   if( data.numberOfLines != visualModel->mLines.Count() )
@@ -4137,8 +4145,8 @@ int UtcDaliTextAlign01(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
@@ -4256,8 +4264,8 @@ int UtcDaliTextAlign02(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
@@ -4375,8 +4383,8 @@ int UtcDaliTextAlign03(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,
@@ -4494,8 +4502,8 @@ int UtcDaliTextAlign04(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
@@ -4613,8 +4621,8 @@ int UtcDaliTextAlign05(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
@@ -4732,8 +4740,8 @@ int UtcDaliTextAlign06(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,
@@ -4851,8 +4859,8 @@ int UtcDaliTextAlign07(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
@@ -4970,8 +4978,8 @@ int UtcDaliTextAlign08(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
@@ -5089,8 +5097,8 @@ int UtcDaliTextAlign09(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,