Merge "Add ENABLE_FONT_SIZE_SCALE property to text components" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20 #include <unistd.h>
21
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
25 #include <dali-toolkit/devel-api/controls/text-controls/text-style-properties-devel.h>
26 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
27 #include <dali/devel-api/text-abstraction/bitmap-font.h>
28 #include <dali/devel-api/text-abstraction/font-client.h>
29 #include <dali/devel-api/adaptor-framework/image-loading.h>
30 #include <dali-toolkit/devel-api/text/bitmap-font.h>
31 #include <dali-toolkit/devel-api/text/rendering-backend.h>
32 #include <dali-toolkit/devel-api/text/text-utils-devel.h>
33 #include "test-text-geometry-utils.h"
34
35 using namespace Dali;
36 using namespace Toolkit;
37
38 void dali_textlabel_startup(void)
39 {
40   test_return_value = TET_UNDEF;
41 }
42
43 void dali_textlabel_cleanup(void)
44 {
45   test_return_value = TET_PASS;
46 }
47
48 namespace
49 {
50
51 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
52 const char* const PROPERTY_NAME_TEXT = "text";
53 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
54 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
55 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
56 const char* const PROPERTY_NAME_MULTI_LINE =  "multiLine";
57 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
58 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
59 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
60 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
61 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
62 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
63 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
64 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
65
66 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
67 const char* const PROPERTY_NAME_UNDERLINE = "underline";
68 const char* const PROPERTY_NAME_SHADOW = "shadow";
69 const char* const PROPERTY_NAME_EMBOSS = "emboss";
70 const char* const PROPERTY_NAME_OUTLINE = "outline";
71 const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
72
73 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
74 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
75 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
76 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
77 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
78
79 const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
80
81 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
82 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
83
84 static bool gAnchorClickedCallBackCalled;
85 static bool gAnchorClickedCallBackNotCalled;
86
87 static bool gTextFitChangedCallBackCalled;
88
89 struct CallbackFunctor
90 {
91   CallbackFunctor(bool* callbackFlag)
92   : mCallbackFlag( callbackFlag )
93   {
94   }
95
96   void operator()()
97   {
98     *mCallbackFlag = true;
99   }
100   bool* mCallbackFlag;
101 };
102
103 static void TestAnchorClickedCallback(TextLabel control, const char* href, unsigned int hrefLength)
104 {
105   tet_infoline(" TestAnchorClickedCallback");
106
107   gAnchorClickedCallBackNotCalled = false;
108
109   if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
110   {
111     gAnchorClickedCallBackCalled = true;
112   }
113 }
114
115 static void TestTextFitChangedCallback(TextLabel control)
116 {
117   tet_infoline(" TestTextFitChangedCallback");
118   gTextFitChangedCallBackCalled = true;
119 }
120
121 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
122 {
123   const Property::Map::SizeType size = mapGet.Count();
124
125   if( size == mapSet.Count() )
126   {
127     for( unsigned int index = 0u; index < size; ++index )
128     {
129       const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
130
131       // Find the keys of the 'get' map
132       Property::Index indexKey = valueGet.first.indexKey;
133       std::string stringKey = valueGet.first.stringKey;
134
135       if( !indexConversionTable.empty() )
136       {
137         if( stringKey.empty() )
138         {
139           stringKey = indexConversionTable[ indexKey ];
140         }
141
142         if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
143         {
144           Property::Index index = 0u;
145           for( auto key : indexConversionTable )
146           {
147             if( key == stringKey )
148             {
149               indexKey = index;
150               break;
151             }
152             ++index;
153           }
154         }
155       }
156
157       const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
158
159       if( nullptr != valueSet )
160       {
161         if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
162         {
163           tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
164           return false;
165         }
166         else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
167         {
168           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
169           return false;
170         }
171         else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
172         {
173           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
174           return false;
175         }
176         else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
177         {
178           tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
179           return false;
180         }
181         else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
182         {
183           Vector2 vector2Get = valueGet.second.Get<Vector2>();
184           Vector2 vector2Set = valueSet->Get<Vector2>();
185           tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
186           return false;
187         }
188         else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
189         {
190           Vector4 vector4Get = valueGet.second.Get<Vector4>();
191           Vector4 vector4Set = valueSet->Get<Vector4>();
192           tet_printf( "Value got : [%f, %f, %f, %f], expected : [%f, %f, %f, %f]", vector4Get.r, vector4Get.g, vector4Get.b, vector4Get.a, vector4Set.r, vector4Set.g, vector4Set.b, vector4Set.a );
193           return false;
194         }
195       }
196       else
197       {
198         if ( valueGet.first.type == Property::Key::INDEX )
199         {
200           tet_printf( "  The key %d doesn't exist.", valueGet.first.indexKey );
201         }
202         else
203         {
204           tet_printf( "  The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
205         }
206         return false;
207       }
208     }
209   }
210
211   return true;
212 }
213
214 } // namespace
215
216 int UtcDaliToolkitTextLabelConstructorP(void)
217 {
218   ToolkitTestApplication application;
219   tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
220   TextLabel textLabel;
221   DALI_TEST_CHECK( !textLabel );
222   END_TEST;
223 }
224
225 int UtcDaliToolkitTextLabelNewP(void)
226 {
227   ToolkitTestApplication application;
228   tet_infoline(" UtcDaliToolkitTextLabelNewP");
229   TextLabel textLabel = TextLabel::New( "Test Text" );
230   DALI_TEST_CHECK( textLabel );
231   END_TEST;
232 }
233
234 int UtcDaliToolkitTextLabelDownCastP(void)
235 {
236   ToolkitTestApplication application;
237   tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
238   TextLabel textLabel1 = TextLabel::New();
239   BaseHandle object( textLabel1 );
240
241   TextLabel textLabel2 = TextLabel::DownCast( object );
242   DALI_TEST_CHECK( textLabel2 );
243
244   TextLabel textLabel3 = DownCast< TextLabel >( object );
245   DALI_TEST_CHECK( textLabel3 );
246   END_TEST;
247 }
248
249 int UtcDaliToolkitTextLabelDownCastN(void)
250 {
251   ToolkitTestApplication application;
252   tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
253   BaseHandle uninitializedObject;
254   TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
255   DALI_TEST_CHECK( !textLabel1 );
256
257   TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
258   DALI_TEST_CHECK( !textLabel2 );
259   END_TEST;
260 }
261
262 int UtcDaliToolkitTextLabelCopyConstructorP(void)
263 {
264   ToolkitTestApplication application;
265   tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
266   TextLabel textLabel = TextLabel::New();
267   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
268
269   TextLabel copy( textLabel );
270   DALI_TEST_CHECK( copy );
271   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
272   END_TEST;
273 }
274
275 int UtcDaliTextLabelMoveConstructor(void)
276 {
277   ToolkitTestApplication application;
278
279   TextLabel textLabel = TextLabel::New();
280   textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
281   DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
282
283   TextLabel moved = std::move( textLabel );
284   DALI_TEST_CHECK( moved );
285   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
286   DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
287   DALI_TEST_CHECK( !textLabel );
288
289   END_TEST;
290 }
291
292 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
293 {
294   ToolkitTestApplication application;
295   tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
296   TextLabel textLabel = TextLabel::New();
297   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
298
299   TextLabel copy = textLabel;
300   DALI_TEST_CHECK( copy );
301   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
302   END_TEST;
303 }
304
305 int UtcDaliTextLabelMoveAssignment(void)
306 {
307   ToolkitTestApplication application;
308
309   TextLabel textLabel = TextLabel::New();
310   textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
311   DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
312
313   TextLabel moved;
314   moved = std::move( textLabel );
315   DALI_TEST_CHECK( moved );
316   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
317   DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
318   DALI_TEST_CHECK( !textLabel );
319
320   END_TEST;
321 }
322
323 // Positive test case for a method
324 int UtcDaliToolkitTextLabelGetPropertyP(void)
325 {
326   ToolkitTestApplication application;
327   tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
328   TextLabel label = TextLabel::New("Test Text");
329   DALI_TEST_CHECK( label );
330
331   // Check Property Indices are correct
332   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == DevelTextLabel::Property::RENDERING_BACKEND );
333   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
334   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
335   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
336   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
337   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
338   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
339   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
340   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
341   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
342   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
343   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
344   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
345   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
346   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
347   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
348   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
349   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
350   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
351   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
352   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
353   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
354   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
355   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
356   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
357   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
358
359   END_TEST;
360 }
361
362 int UtcDaliToolkitTextLabelSetPropertyP(void)
363 {
364   ToolkitTestApplication application;
365   tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
366   TextLabel label = TextLabel::New();
367   DALI_TEST_CHECK( label );
368
369   application.GetScene().Add( label );
370
371   // Note - we can't check the defaults since the stylesheets are platform-specific
372   label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
373   DALI_TEST_EQUALS( (DevelText::RenderingType)label.GetProperty<int>( DevelTextLabel::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION );
374
375   // Check that text can be correctly reset
376   label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
377   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
378
379   // Check font properties.
380   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
381   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
382
383   Property::Map fontStyleMapSet;
384   Property::Map fontStyleMapGet;
385
386   fontStyleMapSet.Insert( "weight", "bold" );
387   fontStyleMapSet.Insert( "width", "condensed" );
388   fontStyleMapSet.Insert( "slant", "italic" );
389   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
390
391   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
392   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
393   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
394
395   // Check the old font style format.
396   fontStyleMapSet.Clear();
397   fontStyleMapSet.Insert( "weight", "thin" );
398   fontStyleMapSet.Insert( "width", "expanded" );
399   fontStyleMapSet.Insert( "slant", "oblique" );
400   const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
401
402   label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
403   std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
404   DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
405
406   label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
407   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
408
409   label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 2.5f );
410   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
411   label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
412
413   label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
414   DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
415   label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
416
417   // Reset font style.
418   fontStyleMapSet.Clear();
419   fontStyleMapSet.Insert( "weight", "normal" );
420   fontStyleMapSet.Insert( "slant", "oblique" );
421
422   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
423   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
424   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
425   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
426
427   fontStyleMapSet.Clear();
428   fontStyleMapSet.Insert( "slant", "roman" );
429
430   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
431   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
432   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
433
434   // Replace 'roman' for 'normal'.
435   Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
436   if( NULL != slantValue )
437   {
438     if( "normal" == slantValue->Get<std::string>() )
439     {
440       fontStyleMapGet["slant"] = "roman";
441     }
442   }
443   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
444
445   fontStyleMapSet.Clear();
446
447   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
448   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
449   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
450   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
451
452   // Toggle multi-line
453   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
454   DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
455
456   // Check that the Alignment properties can be correctly set
457   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
458   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
459   label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
460   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
461
462   // Check that text color can be properly set
463   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
464   DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
465
466   Property::Map underlineMapSet;
467   Property::Map underlineMapGet;
468
469   underlineMapSet.Insert( "enable", false );
470   underlineMapSet.Insert( "color", Color::BLUE );
471   underlineMapSet.Insert( "height", 0 );
472
473   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
474   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
475   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
476
477   TextLabel label2 = TextLabel::New( "New text" );
478   DALI_TEST_CHECK( label2 );
479   DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
480
481   // Check the enable markup property.
482   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
483   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
484   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
485
486   // Check the text property when markup is enabled
487   label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
488   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
489
490   // Check for incomplete marks.
491   label.SetProperty( TextLabel::Property::TEXT, "<color='white'><i>Markup</i><b>Text</b></color>" );
492   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
493   try
494   {
495     application.SendNotification();
496     application.Render();
497   }
498   catch( ... )
499   {
500     tet_result(TET_FAIL);
501   }
502
503   // Check autoscroll properties
504   const int SCROLL_SPEED = 80;
505   const int SCROLL_LOOPS = 4;
506   const float SCROLL_GAP = 50.0f;
507   const float SCROLL_LOOP_DELAY = 0.3f;
508   const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
509   const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
510
511   label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
512   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
513   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
514   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
515   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
516   DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
517   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
518   DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
519   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
520   DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
521   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
522   DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
523
524   //Check autoscroll stop type property
525   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
526   DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
527
528   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
529   DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
530
531   // test natural size with multi-line and line spacing
532   {
533     TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
534     Vector3 oneLineNaturalSize = label3.GetNaturalSize();
535     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
536     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
537     Vector3 multiLineNaturalSize = label3.GetNaturalSize();
538
539     // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
540     // The height of the text when multi-line is enabled will be larger
541     DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
542     DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
543
544     // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
545     // Everything else will remain the same
546     int lineSpacing = 20;
547     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
548     Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
549     expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
550     DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
551   }
552
553   // single line, line spacing must not affect natural size of the text, only add the spacing to the height
554   {
555     TextLabel label3 = TextLabel::New("Some text here end there end here");
556     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
557     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
558     Vector3 textNaturalSize = label3.GetNaturalSize();
559     int lineSpacing = 20;
560     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
561     Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
562     expectedNaturalSizeWithLineSpacing.height += lineSpacing;
563     DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
564   }
565   // Check the line spacing property
566   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
567   label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
568   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
569
570   // Check the underline property
571   underlineMapSet.Clear();
572   underlineMapSet.Insert( "enable", true );
573   underlineMapSet.Insert( "color", Color::RED );
574   underlineMapSet.Insert( "height", 1 );
575
576   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
577
578   application.SendNotification();
579   application.Render();
580
581   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
582   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
583   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
584
585   underlineMapSet.Clear();
586   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true );
587   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN );
588   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 );
589
590   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
591
592   application.SendNotification();
593   application.Render();
594
595   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
596   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
597   std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
598   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
599
600   underlineMapSet.Clear();
601
602   Property::Map underlineDisabledMapGet;
603   underlineDisabledMapGet.Insert( "enable", false );
604   underlineDisabledMapGet.Insert( "color", Color::GREEN );
605   underlineDisabledMapGet.Insert( "height", 2 );
606
607   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
608
609   application.SendNotification();
610   application.Render();
611
612   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
613   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
614   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
615
616   // Check the shadow property
617
618   Property::Map shadowMapSet;
619   Property::Map shadowMapGet;
620
621   shadowMapSet.Insert( "color", Color::GREEN );
622   shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
623   shadowMapSet.Insert( "blurRadius", 5.0f );
624
625   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
626
627   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
628   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
629   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
630
631   shadowMapSet.Clear();
632
633   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
634   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
635   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
636
637   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
638
639   // Replace the offset (string) by a vector2
640   shadowMapSet.Clear();
641   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
642   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
643   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
644
645   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
646   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
647   std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
648   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
649
650   shadowMapSet.Clear();
651   Property::Map shadowDisabledMapGet;
652   shadowDisabledMapGet.Insert( "color", Color::BLUE );
653   shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
654   shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
655
656   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
657
658   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
659   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
660   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
661
662   // Check the emboss property
663   label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
664   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
665
666   // Check the outline property
667
668   // Test string type first
669   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
670   label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
671   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
672
673   // Then test the property map type
674   Property::Map outlineMapSet;
675   Property::Map outlineMapGet;
676
677   outlineMapSet["color"] = Color::RED;
678   outlineMapSet["width"] = 2.0f;
679   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
680
681   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
682   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
683   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
684
685   outlineMapSet.Clear();
686   outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
687   outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
688   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
689
690   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
691   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
692   std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
693   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
694
695   // Check the background property
696   Property::Map backgroundMapSet;
697   Property::Map backgroundMapGet;
698
699   backgroundMapSet["enable"] = true;
700   backgroundMapSet["color"] = Color::RED;
701   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
702
703   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
704   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
705   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
706
707   backgroundMapSet.Clear();
708   backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
709   backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
710   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
711
712   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
713   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
714   std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
715   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
716
717   // Check the pixel size of font
718   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
719   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
720
721   // Check the ellipsis property
722   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
723   label.SetProperty( TextLabel::Property::ELLIPSIS, false );
724   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
725
726   // Check the layout direction property
727   label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
728   DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
729
730   // Check the line size property
731   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
732   label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f );
733   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
734
735   application.SendNotification();
736   application.Render();
737
738   END_TEST;
739 }
740
741 int UtcDaliToolkitTextlabelAtlasRenderP(void)
742 {
743   ToolkitTestApplication application;
744   tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
745   TextLabel label = TextLabel::New("Test Text");
746   DALI_TEST_CHECK( label );
747
748   // Avoid a crash when core load gl resources.
749   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
750
751   application.GetScene().Add( label );
752
753   // Turn on all the effects
754   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
755   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
756
757   Property::Map underlineMap;
758   underlineMap.Insert( "enable", true );
759   underlineMap.Insert( "color", Color::RED );
760   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
761
762   Property::Map shadowMap;
763   shadowMap.Insert( "color", Color::BLUE );
764   shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
765   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
766
767   try
768   {
769     // Render some text with the shared atlas backend
770     label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
771     application.SendNotification();
772     application.Render();
773   }
774   catch( ... )
775   {
776     tet_result(TET_FAIL);
777   }
778
779   try
780   {
781     // Render some text with the shared atlas backend
782     label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED );
783     application.SendNotification();
784     application.Render();
785   }
786   catch( ... )
787   {
788     tet_result(TET_FAIL);
789   }
790   END_TEST;
791 }
792
793 int UtcDaliToolkitTextLabelLanguagesP(void)
794 {
795   ToolkitTestApplication application;
796   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
797   TextLabel label = TextLabel::New();
798   DALI_TEST_CHECK( label );
799
800   application.GetScene().Add( label );
801
802   const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
803                              "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
804                              "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
805                              "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
806                              "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
807                              "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
808
809   label.SetProperty( TextLabel::Property::TEXT, scripts );
810   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
811
812   application.SendNotification();
813   application.Render();
814
815   END_TEST;
816 }
817
818 int UtcDaliToolkitTextLabelEmojisP(void)
819 {
820   ToolkitTestApplication application;
821   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
822   TextLabel label = TextLabel::New();
823   DALI_TEST_CHECK( label );
824
825   application.GetScene().Add( label );
826
827   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
828
829   char* pathNamePtr = get_current_dir_name();
830   const std::string pathName( pathNamePtr );
831   free( pathNamePtr );
832
833   TextAbstraction::FontDescription fontDescription;
834   fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
835   fontDescription.family = "BreezeColorEmoji";
836   fontDescription.width = TextAbstraction::FontWidth::NONE;
837   fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
838   fontDescription.slant = TextAbstraction::FontSlant::NONE;
839
840   fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
841
842   const std::string emojis = "<font family='BreezeColorEmoji' size='60'>\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84</font>";
843   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
844   label.SetProperty( TextLabel::Property::TEXT, emojis );
845
846   Property::Map shadowMap;
847   shadowMap.Insert( "color", "green" );
848   shadowMap.Insert( "offset", "2 2" );
849   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
850
851   application.SendNotification();
852   application.Render();
853
854   // EMOJI + ZWJ + EMOJI case for coverage.
855   const std::string emojiWithZWJ = "&#x1f469;&#x200d;&#x1f52c;";
856   label.SetProperty( TextLabel::Property::TEXT, emojiWithZWJ );
857
858   application.SendNotification();
859   application.Render();
860
861   // EMOJI Sequences case for coverage.
862   std::string emojiSequences =
863        "Text VS15 &#x262a;&#xfe0e;\n"                                                         //text presentation sequence and selector
864       "Color VS16 &#x262a;&#xfe0f;\n"                                                        //emoji presentation sequence and selector
865       "Default &#x262a; \n"                                                                  //default presentation
866       "FamilyManWomanGirlBoy &#x1F468;&#x200D;&#x1F469;&#x200D;&#x1F467;&#x200D;&#x1F466;\n" // emoji multi zwj sequence
867       "WomanScientist &#x1f469;&#x200d;&#x1f52c;\n"                                          // emoji zwj sequence
868       "WomanScientistLightSkinTone&#x1F469;&#x1F3FB;&#x200D;&#x1F52C; \n"                    //emoji modifier sequence: skin tone & JWZ
869       "LeftRightArrowText&#x2194;&#xfe0e;\n"                                                 //text presentation sequence and selector
870       "LeftRightArrowEmoji&#x2194;&#xfe0f;\n"                                                //emoji presentation sequence and selector
871       "SouthKoreaFlag&#x1f1f0;&#x1f1f7;\n"                                                   //emoji flag sequence
872       "JordanFlag&#x1f1ef;&#x1f1f4;\n"                                                       // emoji flag sequence
873       "EnglandFlag&#x1F3F4;&#xE0067;&#xE0062;&#xE0065;&#xE006E;&#xE0067;&#xE007F;\n"         //emoji tag sequence like England flag
874       "Runner &#x1f3c3;&#x200d;&#x27a1;&#xfe0f; \n"
875       "VictoryHandMediumLightSkinTone:&#x270C;&#xFE0F;&#x1F3FC;\n"               //emoji modifier sequence: skin tone
876       "RainbowFlag:&#x1F3F3;&#xFE0F;&#x200D;&#x1F308; \n"                        //emoji zwj sequence: Rainbow Flag
877       "keycap# &#x0023;&#xFE0F;&#x20E3; \n"                                      // fully-qualified  emoji keycap sequence
878       "keycap#_text &#x0023;&#x20E3; \n"                                         // unqualified emoji keycap sequence
879       "keycap3 &#x0033;&#xfe0f;&#x20e3; \n"                                      // fully-qualified  emoji keycap sequence
880       "keycap3_text &#x0033;&#x20e3; \n"                                         // unqualified emoji keycap sequence
881       "two adjacent glyphs &#x262a;&#xfe0f;&#xfe0f;&#xfe0f;&#x262a;&#xfe0f;\n"   //This line should be rendered as two adjacent glyphs
882       "Digit 8&#xfe0f; 8&#xfe0e; 8\n"                                            // should be rendered according to selector
883       "Surfing Medium Skin Female:  &#x1f3c4;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;"; // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
884
885   label.SetProperty( TextLabel::Property::TEXT, emojiSequences );
886   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
887   label.SetProperty( TextLabel::Property::MULTI_LINE, true);
888   label.SetProperty( TextLabel::Property::ELLIPSIS, false);
889
890   application.SendNotification();
891   application.Render();
892   END_TEST;
893 }
894
895 int UtcDaliToolkitTextlabelScrollingP(void)
896 {
897   ToolkitTestApplication application;
898   tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
899   TextLabel labelImmediate = TextLabel::New("Some text to scroll");
900   TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
901
902   DALI_TEST_CHECK( labelImmediate );
903   DALI_TEST_CHECK( labelFinished );
904   // Avoid a crash when core load gl resources.
905   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
906   application.GetScene().Add( labelImmediate );
907   // Turn on all the effects
908   labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
909   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
910   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
911   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
912   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
913
914   application.GetScene().Add( labelFinished );
915   // Turn on all the effects
916   labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
917   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
918   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
919   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
920   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
921
922
923
924   try
925   {
926     // Render some text with the shared atlas backend
927     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
928     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
929
930     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
931     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
932
933     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
934     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
935     application.SendNotification();
936     application.Render();
937
938     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
939     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
940     application.SendNotification();
941     application.Render();
942
943   }
944   catch( ... )
945   {
946     tet_result(TET_FAIL);
947   }
948
949   END_TEST;
950 }
951
952 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
953 {
954   ToolkitTestApplication application;
955   TextLabel labelShort = TextLabel::New("Some text to scroll");
956   TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!");
957
958   DALI_TEST_CHECK( labelShort );
959   DALI_TEST_CHECK( labelLong );
960   // Avoid a crash when core load gl resources.
961   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
962   application.GetScene().Add( labelShort );
963   // Turn on all the effects
964   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
965   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
966   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
967   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
968   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
969   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
970
971   application.GetScene().Add( labelLong );
972   // Turn on all the effects
973   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
974   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
975   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
976   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
977   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
978   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
979
980   try
981   {
982     // Render some text with the shared atlas backend
983     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
984     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
985     application.SendNotification();
986     application.Render();
987
988     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
989     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
990     application.SendNotification();
991     application.Render();
992
993   }
994   catch( ... )
995   {
996     tet_result(TET_FAIL);
997   }
998
999   END_TEST;
1000 }
1001
1002 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
1003 {
1004   ToolkitTestApplication application;
1005   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1006   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1007
1008   DALI_TEST_CHECK( labelShort );
1009   DALI_TEST_CHECK( labelLong );
1010   // Avoid a crash when core load gl resources.
1011   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1012   application.GetScene().Add( labelShort );
1013   // Turn on all the effects
1014   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1015   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1016   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1017   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1018   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1019   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1020
1021   application.GetScene().Add( labelLong );
1022   // Turn on all the effects
1023   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1024   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1025   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1026   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1027   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1028   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1029
1030   try
1031   {
1032     // Render some text with the shared atlas backend
1033     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1034     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1035     application.SendNotification();
1036     application.Render();
1037
1038     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1039     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1040     application.SendNotification();
1041     application.Render();
1042
1043   }
1044   catch( ... )
1045   {
1046     tet_result(TET_FAIL);
1047   }
1048
1049   END_TEST;
1050 }
1051
1052 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
1053 {
1054   ToolkitTestApplication application;
1055   TextLabel labelShort = TextLabel::New("Some text to scroll");
1056   TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!");
1057
1058   DALI_TEST_CHECK( labelShort );
1059   DALI_TEST_CHECK( labelLong );
1060   // Avoid a crash when core load gl resources.
1061   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1062   application.GetScene().Add( labelShort );
1063   // Turn on all the effects
1064   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1065   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1066   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1067   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1068   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1069   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1070
1071   application.GetScene().Add( labelLong );
1072   // Turn on all the effects
1073   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1074   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1075   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1076   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1077   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1078   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1079
1080   try
1081   {
1082     // Render some text with the shared atlas backend
1083     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1084     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1085     application.SendNotification();
1086     application.Render();
1087
1088     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1089     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1090     application.SendNotification();
1091     application.Render();
1092
1093   }
1094   catch( ... )
1095   {
1096     tet_result(TET_FAIL);
1097   }
1098
1099   END_TEST;
1100 }
1101
1102 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
1103 {
1104   ToolkitTestApplication application;
1105   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1106   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1107
1108   DALI_TEST_CHECK( labelShort );
1109   DALI_TEST_CHECK( labelLong );
1110   // Avoid a crash when core load gl resources.
1111   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1112   application.GetScene().Add( labelShort );
1113   // Turn on all the effects
1114   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1115   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1116   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1117   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1118   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1119   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1120
1121   application.GetScene().Add( labelLong );
1122   // Turn on all the effects
1123   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1124   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1125   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1126   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1127   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1128   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1129
1130   try
1131   {
1132     // Render some text with the shared atlas backend
1133     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1134     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1135     application.SendNotification();
1136     application.Render();
1137
1138     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1139     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1140     application.SendNotification();
1141     application.Render();
1142
1143   }
1144   catch( ... )
1145   {
1146     tet_result(TET_FAIL);
1147   }
1148
1149   END_TEST;
1150 }
1151
1152 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1153 {
1154   ToolkitTestApplication application;
1155   tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1156   TextLabel label = TextLabel::New("Some text to scroll");
1157   DALI_TEST_CHECK( label );
1158   // Avoid a crash when core load gl resources.
1159   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1160   application.GetScene().Add( label );
1161   label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 20.f ) );
1162   // Turn on all the effects
1163   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1164   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1165   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1166   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1167
1168   // Render the text.
1169   application.SendNotification();
1170   application.Render();
1171
1172   unsigned int actorCount1 = label.GetChildCount();
1173   tet_printf("Initial actor count is(%d)\n", actorCount1 );
1174
1175   try
1176   {
1177     // Render some text with the shared atlas backend
1178     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1179     application.SendNotification();
1180     application.Render(2000);
1181
1182     unsigned int actorCount1 = label.GetChildCount();
1183     tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1184
1185     label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1186
1187     // Render the text.
1188     application.SendNotification();
1189     application.Render();
1190
1191     unsigned int actorCount2 = label.GetChildCount();
1192     tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1193
1194     DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1195
1196   }
1197   catch( ... )
1198   {
1199     tet_result(TET_FAIL);
1200   }
1201
1202   END_TEST;
1203 }
1204
1205 int UtcDaliToolkitTextlabelScrollingN(void)
1206 {
1207   ToolkitTestApplication application;
1208   tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1209
1210   TextLabel label = TextLabel::New("Some text to scroll");
1211   DALI_TEST_CHECK( label );
1212
1213   application.GetScene().Add( label );
1214
1215   // Avoid a crash when core load gl resources.
1216   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1217
1218   // The text scrolling works only on single line text.
1219   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1220
1221   // Turn on all the effects.
1222   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1223   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1224   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1225
1226   // Enable the auto scrolling effect.
1227   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1228
1229   // The auto scrolling shouldn't be enabled.
1230   const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1231   DALI_TEST_CHECK( !enabled );
1232
1233   END_TEST;
1234 }
1235
1236 int UtcDaliToolkitTextlabelScrollingWithEllipsis(void)
1237 {
1238   ToolkitTestApplication application;
1239   tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis");
1240
1241   TextLabel label = TextLabel::New("Some text to scroll");
1242   DALI_TEST_CHECK( label );
1243
1244   application.GetScene().Add( label );
1245
1246   // Avoid a crash when core load gl resources.
1247   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1248
1249   // Turn on all the effects.
1250   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1251   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1252   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1253
1254   try
1255   {
1256     // Enable the auto scrolling effect.
1257     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1258     label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1259
1260     // Disable the ellipsis
1261     label.SetProperty( TextLabel::Property::ELLIPSIS, false );
1262
1263     // Render the text.
1264     application.SendNotification();
1265     application.Render();
1266
1267     // Stop auto scrolling
1268     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1269
1270     // Check the ellipsis property
1271     DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
1272   }
1273   catch( ... )
1274   {
1275     tet_result(TET_FAIL);
1276   }
1277
1278   END_TEST;
1279 }
1280
1281 int UtcDaliToolkitTextlabelEllipsis(void)
1282 {
1283   ToolkitTestApplication application;
1284   tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1285
1286   TextLabel label = TextLabel::New("Hello world");
1287   DALI_TEST_CHECK( label );
1288
1289   // Avoid a crash when core load gl resources.
1290   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1291
1292   application.GetScene().Add( label );
1293
1294   // Turn on all the effects
1295   label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1296   label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1297   label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 10.f ) );
1298
1299   try
1300   {
1301     // Render the text.
1302     application.SendNotification();
1303     application.Render();
1304   }
1305   catch( ... )
1306   {
1307     tet_result(TET_FAIL);
1308   }
1309
1310   label.SetProperty( TextLabel::Property::TEXT, "Hello world                                        " );
1311   label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1312   label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1313
1314   try
1315   {
1316     // Render the text.
1317     application.SendNotification();
1318     application.Render();
1319   }
1320   catch( ... )
1321   {
1322     tet_result(TET_FAIL);
1323   }
1324
1325
1326   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1327   label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1328   label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1329
1330   try
1331   {
1332     // Render the text.
1333     application.SendNotification();
1334     application.Render();
1335   }
1336   catch( ... )
1337   {
1338     tet_result(TET_FAIL);
1339   }
1340
1341   END_TEST;
1342 }
1343
1344 int UtcDaliToolkitTextlabelTextWrapMode(void)
1345 {
1346   ToolkitTestApplication application;
1347   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1348
1349   int lineCount =0 ;
1350
1351   TextLabel label = TextLabel::New();
1352   label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1353   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1354   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1355
1356
1357
1358   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1359   application.GetScene().Add( label );
1360
1361   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1362   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1363
1364   application.SendNotification();
1365   application.Render();
1366
1367   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1368   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1369
1370   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1371   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1372
1373   application.SendNotification();
1374   application.Render();
1375
1376   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1377   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1378
1379   application.SendNotification();
1380   application.Render();
1381
1382   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1383   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1384
1385   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1386   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1387
1388   application.SendNotification();
1389   application.Render();
1390
1391   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1392   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1393
1394   tet_infoline( "Ensure invalid string does not change wrapping mode" );
1395   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1396   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1397
1398   END_TEST;
1399 }
1400
1401 int UtcDaliToolkitTextLabelColorComponents(void)
1402 {
1403   ToolkitTestApplication application;
1404
1405   TextLabel label = TextLabel::New();
1406   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1407   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   1.0f, TEST_LOCATION );
1408   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1409   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1410   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1411
1412   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1413   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1414   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1415   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1416   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1417
1418   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1419   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1420   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1421   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  1.0f, TEST_LOCATION );
1422   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1423
1424   label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1425   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1426   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1427
1428   // Test a transparent text - Rendering should be skipped.
1429   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1430   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1431
1432   application.GetScene().Add( label );
1433
1434   TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1435   drawTrace.Enable( true );
1436
1437   application.SendNotification();
1438   application.Render();
1439
1440   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION );  // Should be rendered
1441
1442   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1443
1444   drawTrace.Reset();
1445
1446   application.SendNotification();
1447   application.Render();
1448
1449   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1450
1451   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1452
1453   drawTrace.Reset();
1454
1455   application.SendNotification();
1456   application.Render();
1457
1458   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1459
1460   END_TEST;
1461 }
1462
1463 int UtcDaliToolkitTextlabelTextStyle01(void)
1464 {
1465   ToolkitTestApplication application;
1466   tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1467
1468   TextLabel label = TextLabel::New();
1469   label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1470   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1471   label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1472   application.GetScene().Add( label );
1473
1474   Property::Map outlineMapSet;
1475   Property::Map outlineMapGet;
1476
1477   outlineMapSet["color"] = Color::BLUE;
1478   outlineMapSet["width"] = 2.0f;
1479   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1480
1481   application.SendNotification();
1482   application.Render();
1483
1484   Property::Map shadowMapSet;
1485   shadowMapSet.Insert( "color", "green" );
1486   shadowMapSet.Insert( "offset", "2 2" );
1487   shadowMapSet.Insert( "blurRadius", "3" );
1488   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1489
1490   outlineMapSet["color"] = Color::RED;
1491   outlineMapSet["width"] = 0.0f;
1492   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1493
1494   application.SendNotification();
1495   application.Render();
1496
1497   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1498
1499   Property::Value* colorValue = outlineMapGet.Find("color");
1500
1501   bool colorMatched( false );
1502
1503   if ( colorValue )
1504   {
1505      Property::Type valueType = colorValue->GetType();
1506
1507      if ( Property::STRING == valueType )
1508      {
1509        std::string stringValue;
1510        colorValue->Get( stringValue );
1511        if (  stringValue == "red" )
1512        {
1513          colorMatched = true;
1514        }
1515      }
1516      else if ( Property::VECTOR4 == valueType )
1517      {
1518        Vector4 colorVector4;
1519        colorValue->Get( colorVector4 );
1520        if (  colorVector4 == Color::RED )
1521        {
1522          colorMatched = true;
1523        }
1524      }
1525   }
1526
1527   DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1528
1529   END_TEST;
1530 }
1531
1532 int UtcDaliToolkitTextlabelMultiline(void)
1533 {
1534   ToolkitTestApplication application;
1535   tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1536
1537   TextLabel label = TextLabel::New();
1538   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1539   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1540   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1541   application.GetScene().Add( label );
1542
1543   application.SendNotification();
1544   application.Render();
1545
1546   int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1547   DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1548
1549   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1550
1551   application.SendNotification();
1552   application.Render();
1553
1554   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1555   DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1556
1557
1558   END_TEST;
1559 }
1560
1561 int UtcDaliToolkitTextlabelTextDirection(void)
1562 {
1563   ToolkitTestApplication application;
1564   tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1565
1566   TextLabel label = TextLabel::New();
1567   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1568
1569   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1570   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1571   label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
1572   application.GetScene().Add( label );
1573
1574   // Test LTR text
1575   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1576
1577   // Test RTL text
1578   label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1579   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1580
1581   // Test RTL text starting with weak character
1582   label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1583   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1584
1585   // Test RTL text string with emoji and weak character
1586   label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1587   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1588
1589   END_TEST;
1590 }
1591
1592 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1593 {
1594   ToolkitTestApplication application;
1595   tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1596
1597   TextLabel label = TextLabel::New();
1598
1599   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP  );
1600   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1601   label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1602   label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1603   application.GetScene().Add( label );
1604   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1605
1606   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE  );
1607   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1608
1609   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM  );
1610   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1611
1612   END_TEST;
1613 }
1614
1615 int UtcDaliToolkitTextLabelBitmapFont(void)
1616 {
1617   ToolkitTestApplication application;
1618   tet_infoline(" UtcDaliToolkitTextLabelBitmapFont");
1619
1620   DevelText::BitmapFontDescription fontDescription;
1621   fontDescription.name = "Digits";
1622   fontDescription.underlinePosition = 0.f;
1623   fontDescription.underlineThickness = 0.f;
1624
1625   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 34.f, 0.f } );
1626   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f } );
1627   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f } );
1628   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0033.png", "2", 34.f, 0.f } );
1629   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0034.png", "3", 34.f, 0.f } );
1630   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0035.png", "4", 34.f, 0.f } );
1631   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0036.png", "5", 34.f, 0.f } );
1632   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0037.png", "6", 34.f, 0.f } );
1633   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0038.png", "7", 34.f, 0.f } );
1634   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0039.png", "8", 34.f, 0.f } );
1635   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u003a.png", "9", 34.f, 0.f } );
1636
1637   TextAbstraction::BitmapFont bitmapFont;
1638   DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1639
1640   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1641   fontClient.GetFontId( bitmapFont );
1642
1643   TextLabel label = TextLabel::New();
1644
1645   label.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
1646   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1647
1648   // The text has been laid out with the bitmap font if the natural size is the sum of all the width (322) and 34 height.
1649   DALI_TEST_EQUALS( label.GetNaturalSize(), Vector3(322.f, 34.f, 0.f), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1650
1651   application.GetScene().Add( label );
1652
1653   application.SendNotification();
1654   application.Render();
1655
1656   // The text has been rendered if the height of the text-label is the height of the line.
1657   DALI_TEST_EQUALS( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1658
1659   END_TEST;
1660 }
1661
1662 int ConvertPointToPixel( float point )
1663 {
1664   unsigned int horizontalDpi = 0u;
1665   unsigned int verticalDpi = 0u;
1666   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1667   fontClient.GetDpi( horizontalDpi, verticalDpi );
1668
1669   return ( point * 72.f ) / static_cast< float >( horizontalDpi );
1670 }
1671
1672 int UtcDaliToolkitTextlabelTextFit(void)
1673 {
1674   ToolkitTestApplication application;
1675   tet_infoline(" UtcDaliToolkitTextlabelTextFit");
1676   TextLabel label = TextLabel::New();
1677   Vector2 size( 460.0f, 100.0f );
1678   label.SetProperty( Actor::Property::SIZE, size );
1679   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1680
1681    // connect to the text git changed signal.
1682   ConnectionTracker* testTracker = new ConnectionTracker();
1683   DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback);
1684   bool textFitChangedSignal = false;
1685   label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal));
1686   gTextFitChangedCallBackCalled = false;
1687
1688   // check point size
1689   Property::Map textFitMapSet;
1690   textFitMapSet["enable"] = true;
1691   textFitMapSet["minSize"] = 10.f;
1692   textFitMapSet["maxSize"] = 100.f;
1693   textFitMapSet["stepSize"] = -1.f;
1694   textFitMapSet["fontSizeType"] = "pointSize";
1695
1696   label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1697   label.SetProperty( TextLabel::Property::POINT_SIZE, 120.f);
1698
1699   application.GetScene().Add( label );
1700
1701   application.SendNotification();
1702   application.Render();
1703
1704   const Vector3 EXPECTED_NATURAL_SIZE( 450.0f, 96.0f, 0.0f );
1705   DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1706
1707   DALI_TEST_CHECK(gTextFitChangedCallBackCalled);
1708   DALI_TEST_CHECK(textFitChangedSignal);
1709
1710   // check pixel size
1711   textFitMapSet.Clear();
1712   textFitMapSet["enable"] = true;
1713   textFitMapSet["minSize"] = ConvertPointToPixel( 10.f );
1714   textFitMapSet["maxSize"] = ConvertPointToPixel( 100.f );
1715   textFitMapSet["stepSize"] = ConvertPointToPixel ( 1.f );
1716   textFitMapSet["fontSizeType"] = "pixelSize";
1717
1718   label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1719
1720   application.SendNotification();
1721   application.Render();
1722
1723   DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1724
1725   END_TEST;
1726 }
1727
1728 int UtcDaliToolkitTextlabelMaxTextureSet(void)
1729 {
1730   ToolkitTestApplication application;
1731   tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
1732
1733   DevelText::BitmapFontDescription fontDescription;
1734   fontDescription.name = "Digits";
1735   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } );
1736
1737   TextAbstraction::BitmapFont bitmapFont;
1738   DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1739
1740   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1741   fontClient.GetFontId( bitmapFont );
1742
1743   TextLabel label = TextLabel::New();
1744   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1745   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
1746   label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." );
1747   label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f );
1748   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1749
1750   Property::Map underlineMapSet;
1751   underlineMapSet.Clear();
1752   underlineMapSet.Insert( "enable", true );
1753   underlineMapSet.Insert( "color", Color::RED );
1754   underlineMapSet.Insert( "height", 1 );
1755   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
1756   label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1757
1758   application.GetScene().Add( label );
1759
1760   application.SendNotification();
1761   application.Render();
1762
1763   const int maxTextureSize = Dali::GetMaxTextureSize();
1764   // Whether the rendered text is greater than maxTextureSize
1765   DALI_TEST_CHECK( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height > maxTextureSize );
1766
1767   // Check if the number of renderers is greater than 1.
1768   DALI_TEST_CHECK( label.GetRendererCount() > 1u );
1769
1770   END_TEST;
1771 }
1772
1773 int UtcDaliToolkitTextlabelLastCharacterIndex(void)
1774 {
1775   ToolkitTestApplication application;
1776   tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
1777
1778   Vector2 size( 300.0f, 100.0f );
1779
1780   Dali::Toolkit::DevelText::RendererParameters textParameters;
1781   textParameters.text = "This is a sample text to get the last index.";
1782   textParameters.layout = "multiLine";
1783   textParameters.fontSize = 20.f;
1784   textParameters.textWidth = 300u;
1785   textParameters.textHeight = 100u;
1786   textParameters.ellipsisEnabled = true;
1787   Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex( textParameters );
1788
1789   DALI_TEST_CHECK( !indexArray.Empty() );
1790   DALI_TEST_EQUALS( indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION );
1791
1792   END_TEST;
1793 }
1794
1795 int UtcDaliToolkitTextlabelFontSizeScale(void)
1796 {
1797   ToolkitTestApplication application;
1798   tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
1799
1800   TextLabel label = TextLabel::New();
1801   label.SetProperty( TextLabel::Property::POINT_SIZE, 30.f );
1802   label.SetProperty( TextLabel::Property::TEXT, "Test" );
1803   Vector3 nonScaledSize = label.GetNaturalSize();
1804
1805   TextLabel labelScaled = TextLabel::New();
1806   labelScaled.SetProperty( TextLabel::Property::POINT_SIZE, 15.f );
1807   labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1808   labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1809   Vector3 scaledSize = labelScaled.GetNaturalSize();
1810
1811   DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1812
1813   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 30.f );
1814   label.SetProperty( TextLabel::Property::TEXT, "Test" );
1815   nonScaledSize = label.GetNaturalSize();
1816
1817   labelScaled.SetProperty( TextLabel::Property::PIXEL_SIZE, 15.f );
1818   labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1819   labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1820   scaledSize = labelScaled.GetNaturalSize();
1821
1822   DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1823
1824   END_TEST;
1825 }
1826
1827 // Positive test for the anchorClicked signal.
1828 int UtcDaliToolkitTextlabelAnchorClicked(void)
1829 {
1830   ToolkitTestApplication application;
1831   tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
1832   TextLabel label = TextLabel::New();
1833   DALI_TEST_CHECK(label);
1834
1835   application.GetScene().Add(label);
1836
1837   // connect to the anchor clicked signal.
1838   ConnectionTracker* testTracker = new ConnectionTracker();
1839   DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
1840   bool anchorClickedSignal = false;
1841   label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1842
1843   gAnchorClickedCallBackCalled = false;
1844   label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1845   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1846   label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1847   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1848   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1849
1850   application.SendNotification();
1851   application.Render();
1852
1853   // Create a tap event to touch the text label.
1854   TestGenerateTap(application, 5.0f, 25.0f, 100);
1855   application.SendNotification();
1856   application.Render();
1857
1858   DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1859   DALI_TEST_CHECK(anchorClickedSignal);
1860
1861   // reset
1862   gAnchorClickedCallBackCalled = false;
1863   anchorClickedSignal = false;
1864   label.SetProperty(TextLabel::Property::TEXT, "");
1865   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, false);
1866
1867   application.SendNotification();
1868   application.Render();
1869
1870   // sets anchor text
1871   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1872   label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1873   label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1874   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1875   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1876
1877   application.SendNotification();
1878   application.Render();
1879
1880   // Create a tap event to touch the text label.
1881   TestGenerateTap(application, 5.0f, 25.0f, 200);
1882   application.SendNotification();
1883   application.Render();
1884
1885   DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1886   DALI_TEST_CHECK(anchorClickedSignal);
1887
1888
1889   gAnchorClickedCallBackNotCalled = true;
1890   // Tap the outside of anchor, callback should not be called.
1891   TestGenerateTap(application, 150.f, 100.f, 300);
1892   application.SendNotification();
1893   application.Render();
1894
1895   DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1896
1897   END_TEST;
1898 }
1899
1900 int UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize(void)
1901 {
1902   ToolkitTestApplication application;
1903   tet_infoline(" UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize ");
1904
1905   //TextLabel is not using Atlas but this is to unify font-size on text-controllers
1906
1907   // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
1908   const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
1909   const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
1910
1911   // Create a text editor
1912   TextLabel textLabel = TextLabel::New();
1913   //Set size to avoid automatic eliding
1914   textLabel.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
1915   //Set very large font-size using point-size
1916   textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 1000);
1917   //Specify font-family
1918   textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1919   //Set text to check if appear or not
1920   textLabel.SetProperty( TextLabel::Property::TEXT, "A");
1921
1922   application.GetScene().Add( textLabel );
1923
1924   application.SendNotification();
1925   application.Render();
1926   //Use GetNaturalSize to verify that size of block does not exceed Atlas size
1927   Vector3 naturalSize = textLabel.GetNaturalSize();
1928
1929   DALI_TEST_GREATER( lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION );
1930   DALI_TEST_GREATER( lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION );
1931
1932   END_TEST;
1933 }
1934
1935 int UtcDaliTextLabelHyphenWrapMode(void)
1936 {
1937   ToolkitTestApplication application;
1938   tet_infoline(" UtcDaliTextLabelHyphenWrapMode ");
1939
1940   int lineCount =0;
1941   TextLabel label = TextLabel::New();
1942   label.SetProperty( Actor::Property::SIZE, Vector2( 150.0f, 300.f ));
1943   label.SetProperty( TextLabel::Property::POINT_SIZE, 12.f );
1944   label.SetProperty( TextLabel::Property::MULTI_LINE, true);
1945   application.GetScene().Add( label );
1946   application.SendNotification();
1947   application.Render();
1948
1949   label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
1950   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::HYPHENATION);
1951   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::HYPHENATION ), TEST_LOCATION );
1952
1953   application.SendNotification();
1954   application.Render();
1955
1956   lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1957   /*
1958     text will be :
1959     Hi Exp-
1960     erimen
1961   */
1962   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1963
1964   label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
1965   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::MIXED);
1966   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::MIXED ), TEST_LOCATION );
1967
1968   application.SendNotification();
1969   application.Render();
1970
1971   lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1972   /*
1973     text will be :
1974     Hi
1975     Experi-
1976     men
1977   */
1978   DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
1979
1980   END_TEST;
1981 }
1982
1983
1984 int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
1985 {
1986   ToolkitTestApplication application;
1987
1988   tet_infoline(" utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged ");
1989
1990   int lineCountBefore =0 ;
1991   int lineCountAfter =0 ;
1992
1993   // Create a text editor
1994   TextLabel textLabel = TextLabel::New();
1995   //Set very large font-size using point-size
1996   textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
1997   //Specify font-family
1998   textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1999   //Specify size
2000   textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 100.f ) );
2001   //Set text longer than width of textLabel
2002   textLabel.SetProperty( TextLabel::Property::TEXT, "Short text");
2003   //Set line wrap mode Character
2004   textLabel.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
2005   textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
2006
2007   application.GetScene().Add( textLabel );
2008
2009   application.SendNotification();
2010   application.Render();
2011
2012
2013   lineCountBefore =  textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2014
2015   textLabel.SetProperty( TextLabel::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
2016   lineCountAfter =  textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2017
2018   // When the text changed, the Line-count should be updated according to new text.
2019   // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
2020   DALI_TEST_EQUALS( lineCountBefore ,1, TEST_LOCATION );
2021   DALI_TEST_GREATER( lineCountAfter,1, TEST_LOCATION );
2022
2023
2024   END_TEST;
2025 }
2026
2027 int utcDaliTextLabelGeometryRTL(void)
2028 {
2029   ToolkitTestApplication application;
2030   tet_infoline(" utcDaliTextLabelGeometryRTL");
2031
2032   TextLabel label = TextLabel::New();
2033   DALI_TEST_CHECK( label );
2034
2035   application.GetScene().Add( label );
2036
2037   label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2038   label.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 100.f ) );
2039   label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2040   label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2041   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2042   label.SetProperty( TextLabel::Property::MULTI_LINE, true);
2043   label.SetProperty( TextLabel::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر" );
2044
2045   // Avoid a crash when core load gl resources.
2046   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2047
2048   // Render and notify
2049   application.SendNotification();
2050   application.Render();
2051
2052   unsigned int expectedCount = 4;
2053   unsigned int startIndex = 3;
2054   unsigned int endIndex = 24;
2055
2056   Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2057   Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2058
2059   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2060   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2061
2062   Vector<Vector2> expectedSizes;
2063   Vector<Vector2> expectedPositions;
2064
2065   expectedPositions.PushBack(Vector2(24, 0));
2066   expectedSizes.PushBack(Vector2(33, 25));
2067
2068   expectedPositions.PushBack(Vector2(-1, 25));
2069   expectedSizes.PushBack(Vector2(52, 25));
2070
2071   expectedPositions.PushBack(Vector2(-1, 50));
2072   expectedSizes.PushBack(Vector2(59, 25));
2073
2074   expectedPositions.PushBack(Vector2(73, 75));
2075   expectedSizes.PushBack(Vector2(37, 25));
2076
2077   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2078
2079   END_TEST;
2080 }
2081
2082 int utcDaliTextLabelGeometryGlyphMiddle(void)
2083 {
2084   ToolkitTestApplication application;
2085   tet_infoline(" utcDaliTextLabelGeometryGlyphMiddle");
2086
2087   TextLabel label = TextLabel::New();
2088   DALI_TEST_CHECK( label );
2089
2090   application.GetScene().Add( label );
2091
2092   label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2093   label.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
2094   label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2095   label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2096   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2097   label.SetProperty( TextLabel::Property::TEXT, "لا تحتوي على لا" );
2098
2099   // Avoid a crash when core load gl resources.
2100   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2101
2102   // Render and notify
2103   application.SendNotification();
2104   application.Render();
2105
2106   unsigned int expectedCount = 1;
2107   unsigned int startIndex = 1;
2108   unsigned int endIndex = 13;
2109
2110   Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2111   Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2112
2113   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2114   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2115
2116   Vector<Vector2> expectedSizes;
2117   Vector<Vector2> expectedPositions;
2118
2119   expectedPositions.PushBack(Vector2(12, 0));
2120   expectedSizes.PushBack(Vector2(118, 25));
2121
2122   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2123
2124   END_TEST;
2125 }
2126
2127 int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
2128 {
2129   ToolkitTestApplication application;
2130   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
2131   TextLabel textLabel = TextLabel::New();
2132
2133   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
2134   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2135
2136   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
2137   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
2138   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2139
2140   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
2141   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
2142   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2143
2144   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
2145   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
2146   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2147
2148   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
2149   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
2150   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2151
2152   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
2153   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
2154   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2155
2156   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
2157   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
2158   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2159
2160   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
2161   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
2162   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2163
2164   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
2165   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
2166   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2167
2168   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
2169   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
2170   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2171
2172   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
2173   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
2174   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2175
2176   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
2177   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
2178   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2179
2180   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
2181   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
2182   DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2183
2184
2185   END_TEST;
2186 }