(Text Label) Ensure we recalculate natural size when multi-line is
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
1 /*
2  * Copyright (c) 2019 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/text/text-enumerations-devel.h>
26
27 using namespace Dali;
28 using namespace Toolkit;
29
30 void dali_textlabel_startup(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void dali_textlabel_cleanup(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 namespace
41 {
42
43 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
44 const char* const PROPERTY_NAME_TEXT = "text";
45 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
46 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
47 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
48 const char* const PROPERTY_NAME_MULTI_LINE =  "multiLine";
49 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
50 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
51 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
52 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
53 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
54 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
55 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
56 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
57
58 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
59 const char* const PROPERTY_NAME_UNDERLINE = "underline";
60 const char* const PROPERTY_NAME_SHADOW = "shadow";
61 const char* const PROPERTY_NAME_EMBOSS = "emboss";
62 const char* const PROPERTY_NAME_OUTLINE = "outline";
63 const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
64
65 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
66 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
67 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
68
69 const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
70 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
71 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
72
73 bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
74 {
75   if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
76   {
77     for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
78     {
79       const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
80
81       Property::Value* valueSet = NULL;
82       if ( valueGet.first.type == Property::Key::INDEX )
83       {
84         valueSet = fontStyleMapSet.Find( valueGet.first.indexKey );
85       }
86       else
87       {
88         // Get Key is a string so searching Set Map for a string key
89         valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
90       }
91
92       if( NULL != valueSet )
93       {
94         if( valueSet->GetType() == Dali::Property::STRING && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
95         {
96           tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
97           return false;
98         }
99         else if( valueSet->GetType() == Dali::Property::BOOLEAN && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
100         {
101           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
102           return false;
103         }
104         else if( valueSet->GetType() == Dali::Property::INTEGER && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
105         {
106           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
107           return false;
108         }
109         else if( valueSet->GetType() == Dali::Property::FLOAT && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
110         {
111           tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
112           return false;
113         }
114         else if( valueSet->GetType() == Dali::Property::VECTOR2 && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
115         {
116           Vector2 vector2Get = valueGet.second.Get<Vector2>();
117           Vector2 vector2Set = valueSet->Get<Vector2>();
118           tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
119           return false;
120         }
121         else if( valueSet->GetType() == Dali::Property::VECTOR4 && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
122         {
123           Vector4 vector4Get = valueGet.second.Get<Vector4>();
124           Vector4 vector4Set = valueSet->Get<Vector4>();
125           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 );
126           return false;
127         }
128       }
129       else
130       {
131         if ( valueGet.first.type == Property::Key::INDEX )
132         {
133           tet_printf( "  The key %d doesn't exist.", valueGet.first.indexKey );
134         }
135         else
136         {
137           tet_printf( "  The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
138         }
139         return false;
140       }
141     }
142   }
143
144   return true;
145 }
146
147 } // namespace
148
149 int UtcDaliToolkitTextLabelConstructorP(void)
150 {
151   ToolkitTestApplication application;
152   tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
153   TextLabel textLabel;
154   DALI_TEST_CHECK( !textLabel );
155   END_TEST;
156 }
157
158 int UtcDaliToolkitTextLabelNewP(void)
159 {
160   ToolkitTestApplication application;
161   tet_infoline(" UtcDaliToolkitTextLabelNewP");
162   TextLabel textLabel = TextLabel::New( "Test Text" );
163   DALI_TEST_CHECK( textLabel );
164   END_TEST;
165 }
166
167 int UtcDaliToolkitTextLabelDownCastP(void)
168 {
169   ToolkitTestApplication application;
170   tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
171   TextLabel textLabel1 = TextLabel::New();
172   BaseHandle object( textLabel1 );
173
174   TextLabel textLabel2 = TextLabel::DownCast( object );
175   DALI_TEST_CHECK( textLabel2 );
176
177   TextLabel textLabel3 = DownCast< TextLabel >( object );
178   DALI_TEST_CHECK( textLabel3 );
179   END_TEST;
180 }
181
182 int UtcDaliToolkitTextLabelDownCastN(void)
183 {
184   ToolkitTestApplication application;
185   tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
186   BaseHandle uninitializedObject;
187   TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
188   DALI_TEST_CHECK( !textLabel1 );
189
190   TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
191   DALI_TEST_CHECK( !textLabel2 );
192   END_TEST;
193 }
194
195 int UtcDaliToolkitTextLabelCopyConstructorP(void)
196 {
197   ToolkitTestApplication application;
198   tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
199   TextLabel textLabel = TextLabel::New();
200   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
201
202   TextLabel copy( textLabel );
203   DALI_TEST_CHECK( copy );
204   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
205   END_TEST;
206 }
207
208 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
209 {
210   ToolkitTestApplication application;
211   tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
212   TextLabel textLabel = TextLabel::New();
213   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
214
215   TextLabel copy = textLabel;
216   DALI_TEST_CHECK( copy );
217   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
218   END_TEST;
219 }
220
221 // Positive test case for a method
222 int UtcDaliToolkitTextLabelGetPropertyP(void)
223 {
224   ToolkitTestApplication application;
225   tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
226   TextLabel label = TextLabel::New("Test Text");
227   DALI_TEST_CHECK( label );
228
229   // Check Property Indices are correct
230   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextLabel::Property::RENDERING_BACKEND );
231   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
232   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
233   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
234   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
235   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
236   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
237   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
238   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
239   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
240   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
241   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
242   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
243   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
244   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
245   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
246   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
247   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
248   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
249   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
250   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
251   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
252   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
253
254   END_TEST;
255 }
256
257 int UtcDaliToolkitTextLabelSetPropertyP(void)
258 {
259   ToolkitTestApplication application;
260   tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
261   TextLabel label = TextLabel::New();
262   DALI_TEST_CHECK( label );
263
264   Stage::GetCurrent().Add( label );
265
266   // Note - we can't check the defaults since the stylesheets are platform-specific
267   label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
268   DALI_TEST_EQUALS( (Text::RenderingType)label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
269
270   // Check that text can be correctly reset
271   label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
272   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
273
274   // Check font properties.
275   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
276   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
277
278   Property::Map fontStyleMapSet;
279   Property::Map fontStyleMapGet;
280
281   fontStyleMapSet.Insert( "weight", "bold" );
282   fontStyleMapSet.Insert( "width", "condensed" );
283   fontStyleMapSet.Insert( "slant", "italic" );
284   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
285
286   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
287   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
288   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
289
290   // Check the old font style format.
291   fontStyleMapSet.Clear();
292   fontStyleMapSet.Insert( "weight", "thin" );
293   fontStyleMapSet.Insert( "width", "expanded" );
294   fontStyleMapSet.Insert( "slant", "oblique" );
295   const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
296
297   label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
298   std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
299   DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
300
301   label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
302   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
303
304   // Reset font style.
305   fontStyleMapSet.Clear();
306   fontStyleMapSet.Insert( "weight", "normal" );
307   fontStyleMapSet.Insert( "slant", "oblique" );
308
309   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
310   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
311   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
312   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
313
314   fontStyleMapSet.Clear();
315   fontStyleMapSet.Insert( "slant", "roman" );
316
317   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
318   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
319   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
320
321   // Replace 'roman' for 'normal'.
322   Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
323   if( NULL != slantValue )
324   {
325     if( "normal" == slantValue->Get<std::string>() )
326     {
327       fontStyleMapGet["slant"] = "roman";
328     }
329   }
330   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
331
332   fontStyleMapSet.Clear();
333
334   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
335   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
336   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
337   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
338
339   // Toggle multi-line
340   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
341   DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
342
343   // Check that the Alignment properties can be correctly set
344   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
345   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
346   label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
347   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
348
349   // Check that text color can be properly set
350   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
351   DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
352
353   Property::Map underlineMapSet;
354   Property::Map underlineMapGet;
355
356   underlineMapSet.Insert( "enable", "false" );
357   underlineMapSet.Insert( "color", "blue" );
358   underlineMapSet.Insert( "height", "0" );
359
360   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
361   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
362   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
363
364   TextLabel label2 = TextLabel::New( "New text" );
365   DALI_TEST_CHECK( label2 );
366   DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
367
368   // Check the enable markup property.
369   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
370   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
371   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
372
373   // Check the text property when markup is enabled
374   label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
375   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
376
377   application.SendNotification();
378   application.Render();
379
380   // Check autoscroll properties
381   const int SCROLL_SPEED = 80;
382   const int SCROLL_LOOPS = 4;
383   const float SCROLL_GAP = 50.0f;
384   const float SCROLL_LOOP_DELAY = 0.3f;
385   const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
386   const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
387
388   label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
389   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
390   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
391   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
392   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
393   DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
394   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
395   DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
396   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
397   DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
398   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
399   DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
400
401   //Check autoscroll stop type property
402   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
403   DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
404
405   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
406   DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
407
408   // test natural size with multi-line and line spacing
409   {
410     TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
411     Vector3 oneLineNaturalSize = label3.GetNaturalSize();
412     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
413     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
414     Vector3 multiLineNaturalSize = label3.GetNaturalSize();
415
416     // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
417     // The height of the text when multi-line is enabled will be larger
418     DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
419     DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
420
421     // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
422     // Everything else will remain the same
423     int lineSpacing = 20;
424     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
425     Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
426     expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
427     DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
428   }
429
430   // single line, line spacing must not affect natural size of the text, only add the spacing to the height
431   {
432     TextLabel label3 = TextLabel::New("Some text here end there end here");
433     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
434     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
435     Vector3 textNaturalSize = label3.GetNaturalSize();
436     int lineSpacing = 20;
437     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
438     Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
439     expectedNaturalSizeWithLineSpacing.height += lineSpacing;
440     DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
441   }
442   // Check the line spacing property
443   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
444   label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
445   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
446
447   // Check the underline property
448   underlineMapSet.Clear();
449   underlineMapSet.Insert( "enable", "true" );
450   underlineMapSet.Insert( "color", "red" );
451   underlineMapSet.Insert( "height", "1" );
452
453   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
454
455   application.SendNotification();
456   application.Render();
457
458   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
459   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
460   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
461
462   underlineMapSet.Clear();
463
464   Property::Map underlineDisabledMapGet;
465   underlineDisabledMapGet.Insert( "enable", "false" );
466   underlineDisabledMapGet.Insert( "color", "red" );
467   underlineDisabledMapGet.Insert( "height", "1" );
468
469   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
470   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
471   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
472   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
473
474   // Check the shadow property
475
476   Property::Map shadowMapSet;
477   Property::Map shadowMapGet;
478
479   shadowMapSet.Insert( "color", Color::GREEN );
480   shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
481   shadowMapSet.Insert( "blurRadius", 5.0f );
482
483   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
484
485   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
486   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
487   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
488
489   shadowMapSet.Clear();
490   Property::Map shadowDisabledMapGet;
491   shadowDisabledMapGet.Insert( "color", Color::GREEN );
492   shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
493   shadowDisabledMapGet.Insert( "blurRadius", 5.0f );
494
495   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
496
497   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
498   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
499   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
500
501   // Check the emboss property
502   label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
503   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
504
505   // Check the outline property
506
507   // Test string type first
508   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
509   label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
510   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
511
512   // Then test the property map type
513   Property::Map outlineMapSet;
514   Property::Map outlineMapGet;
515
516   outlineMapSet["color"] = Color::RED;
517   outlineMapSet["width"] = 2.0f;
518   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
519
520   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
521   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
522   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
523
524   // Check the background property
525   Property::Map backgroundMapSet;
526   Property::Map backgroundMapGet;
527
528   backgroundMapSet["enable"] = true;
529   backgroundMapSet["color"] = Color::RED;
530   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
531
532   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
533   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
534   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
535
536   // Check the pixel size of font
537   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
538   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
539
540   // Check the ellipsis property
541   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
542   label.SetProperty( TextLabel::Property::ELLIPSIS, false );
543   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
544
545   // Check the layout direction property
546   label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
547   DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
548
549   application.SendNotification();
550   application.Render();
551
552   END_TEST;
553 }
554
555 int UtcDaliToolkitTextlabelAtlasRenderP(void)
556 {
557   ToolkitTestApplication application;
558   tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
559   TextLabel label = TextLabel::New("Test Text");
560   DALI_TEST_CHECK( label );
561
562   // Avoid a crash when core load gl resources.
563   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
564
565   Stage::GetCurrent().Add( label );
566
567   // Turn on all the effects
568   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
569   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
570
571   Property::Map underlineMap;
572   underlineMap.Insert( "enable", "true" );
573   underlineMap.Insert( "color", "red" );
574   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
575
576   Property::Map shadowMap;
577   shadowMap.Insert( "color", Color::BLUE );
578   shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
579   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
580
581   try
582   {
583     // Render some text with the shared atlas backend
584     label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
585     application.SendNotification();
586     application.Render();
587   }
588   catch( ... )
589   {
590     tet_result(TET_FAIL);
591   }
592
593   try
594   {
595     // Render some text with the shared atlas backend
596     label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_VECTOR_BASED );
597     application.SendNotification();
598     application.Render();
599   }
600   catch( ... )
601   {
602     tet_result(TET_FAIL);
603   }
604   END_TEST;
605 }
606
607 int UtcDaliToolkitTextLabelLanguagesP(void)
608 {
609   ToolkitTestApplication application;
610   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
611   TextLabel label = TextLabel::New();
612   DALI_TEST_CHECK( label );
613
614   Stage::GetCurrent().Add( label );
615
616   const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
617                              "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
618                              "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
619                              "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
620                              "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
621                              "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
622
623   label.SetProperty( TextLabel::Property::TEXT, scripts );
624   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
625
626   application.SendNotification();
627   application.Render();
628
629   END_TEST;
630 }
631
632 int UtcDaliToolkitTextLabelEmojisP(void)
633 {
634   ToolkitTestApplication application;
635   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
636   TextLabel label = TextLabel::New();
637   DALI_TEST_CHECK( label );
638
639   Stage::GetCurrent().Add( label );
640
641   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
642
643   char* pathNamePtr = get_current_dir_name();
644   const std::string pathName( pathNamePtr );
645   free( pathNamePtr );
646
647   TextAbstraction::FontDescription fontDescription;
648   fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
649   fontDescription.family = "BreezeColorEmoji";
650   fontDescription.width = TextAbstraction::FontWidth::NONE;
651   fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
652   fontDescription.slant = TextAbstraction::FontSlant::NONE;
653
654   fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
655
656   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>";
657   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
658   label.SetProperty( TextLabel::Property::TEXT, emojis );
659
660   Property::Map shadowMap;
661   shadowMap.Insert( "color", "green" );
662   shadowMap.Insert( "offset", "2 2" );
663   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
664
665   application.SendNotification();
666   application.Render();
667
668   END_TEST;
669 }
670
671 int UtcDaliToolkitTextlabelScrollingP(void)
672 {
673   ToolkitTestApplication application;
674   tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
675   TextLabel labelImmediate = TextLabel::New("Some text to scroll");
676   TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
677
678   DALI_TEST_CHECK( labelImmediate );
679   DALI_TEST_CHECK( labelFinished );
680   // Avoid a crash when core load gl resources.
681   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
682   Stage::GetCurrent().Add( labelImmediate );
683   // Turn on all the effects
684   labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
685   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
686   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
687   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
688   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
689
690   Stage::GetCurrent().Add( labelFinished );
691   // Turn on all the effects
692   labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
693   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
694   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
695   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
696   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
697
698
699
700   try
701   {
702     // Render some text with the shared atlas backend
703     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
704     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
705
706     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
707     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
708
709     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
710     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
711     application.SendNotification();
712     application.Render();
713
714     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
715     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
716     application.SendNotification();
717     application.Render();
718
719   }
720   catch( ... )
721   {
722     tet_result(TET_FAIL);
723   }
724
725   END_TEST;
726 }
727
728 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
729 {
730   ToolkitTestApplication application;
731   TextLabel labelShort = TextLabel::New("Some text to scroll");
732   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!");
733
734   DALI_TEST_CHECK( labelShort );
735   DALI_TEST_CHECK( labelLong );
736   // Avoid a crash when core load gl resources.
737   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
738   Stage::GetCurrent().Add( labelShort );
739   // Turn on all the effects
740   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
741   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
742   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
743   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
744   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
745   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
746
747   Stage::GetCurrent().Add( labelLong );
748   // Turn on all the effects
749   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
750   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
751   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
752   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
753   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
754   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
755
756   try
757   {
758     // Render some text with the shared atlas backend
759     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
760     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
761     application.SendNotification();
762     application.Render();
763
764     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
765     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
766     application.SendNotification();
767     application.Render();
768
769   }
770   catch( ... )
771   {
772     tet_result(TET_FAIL);
773   }
774
775   END_TEST;
776 }
777
778 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
779 {
780   ToolkitTestApplication application;
781   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
782   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
783
784   DALI_TEST_CHECK( labelShort );
785   DALI_TEST_CHECK( labelLong );
786   // Avoid a crash when core load gl resources.
787   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
788   Stage::GetCurrent().Add( labelShort );
789   // Turn on all the effects
790   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
791   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
792   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
793   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
794   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
795   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
796
797   Stage::GetCurrent().Add( labelLong );
798   // Turn on all the effects
799   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
800   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
801   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
802   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
803   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
804   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
805
806   try
807   {
808     // Render some text with the shared atlas backend
809     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
810     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
811     application.SendNotification();
812     application.Render();
813
814     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
815     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
816     application.SendNotification();
817     application.Render();
818
819   }
820   catch( ... )
821   {
822     tet_result(TET_FAIL);
823   }
824
825   END_TEST;
826 }
827
828 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
829 {
830   ToolkitTestApplication application;
831   TextLabel labelShort = TextLabel::New("Some text to scroll");
832   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!");
833
834   DALI_TEST_CHECK( labelShort );
835   DALI_TEST_CHECK( labelLong );
836   // Avoid a crash when core load gl resources.
837   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
838   Stage::GetCurrent().Add( labelShort );
839   // Turn on all the effects
840   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
841   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
842   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
843   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
844   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
845   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
846
847   Stage::GetCurrent().Add( labelLong );
848   // Turn on all the effects
849   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
850   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
851   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
852   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
853   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
854   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
855
856   try
857   {
858     // Render some text with the shared atlas backend
859     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
860     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
861     application.SendNotification();
862     application.Render();
863
864     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
865     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
866     application.SendNotification();
867     application.Render();
868
869   }
870   catch( ... )
871   {
872     tet_result(TET_FAIL);
873   }
874
875   END_TEST;
876 }
877
878 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
879 {
880   ToolkitTestApplication application;
881   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
882   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
883
884   DALI_TEST_CHECK( labelShort );
885   DALI_TEST_CHECK( labelLong );
886   // Avoid a crash when core load gl resources.
887   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
888   Stage::GetCurrent().Add( labelShort );
889   // Turn on all the effects
890   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
891   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
892   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
893   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
894   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
895   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
896
897   Stage::GetCurrent().Add( labelLong );
898   // Turn on all the effects
899   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
900   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
901   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
902   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
903   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
904   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
905
906   try
907   {
908     // Render some text with the shared atlas backend
909     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
910     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
911     application.SendNotification();
912     application.Render();
913
914     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
915     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
916     application.SendNotification();
917     application.Render();
918
919   }
920   catch( ... )
921   {
922     tet_result(TET_FAIL);
923   }
924
925   END_TEST;
926 }
927
928 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
929 {
930   ToolkitTestApplication application;
931   tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
932   TextLabel label = TextLabel::New("Some text to scroll");
933   DALI_TEST_CHECK( label );
934   // Avoid a crash when core load gl resources.
935   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
936   Stage::GetCurrent().Add( label );
937   label.SetSize( 360.0f, 20.f );
938   // Turn on all the effects
939   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
940   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
941   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
942   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
943
944   // Render the text.
945   application.SendNotification();
946   application.Render();
947
948   unsigned int actorCount1 = label.GetChildCount();
949   tet_printf("Initial actor count is(%d)\n", actorCount1 );
950
951   try
952   {
953     // Render some text with the shared atlas backend
954     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
955     application.SendNotification();
956     application.Render(2000);
957
958     unsigned int actorCount1 = label.GetChildCount();
959     tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
960
961     label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
962
963     // Render the text.
964     application.SendNotification();
965     application.Render();
966
967     unsigned int actorCount2 = label.GetChildCount();
968     tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
969
970     DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
971
972   }
973   catch( ... )
974   {
975     tet_result(TET_FAIL);
976   }
977
978   END_TEST;
979 }
980
981 int UtcDaliToolkitTextlabelScrollingN(void)
982 {
983   ToolkitTestApplication application;
984   tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
985
986   TextLabel label = TextLabel::New("Some text to scroll");
987   DALI_TEST_CHECK( label );
988
989   Stage::GetCurrent().Add( label );
990
991   // Avoid a crash when core load gl resources.
992   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
993
994   // The text scrolling works only on single line text.
995   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
996
997   // Turn on all the effects.
998   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
999   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1000   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1001
1002   // Enable the auto scrolling effect.
1003   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1004
1005   // The auto scrolling shouldn't be enabled.
1006   const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1007   DALI_TEST_CHECK( !enabled );
1008
1009   END_TEST;
1010 }
1011
1012 int UtcDaliToolkitTextlabelEllipsis(void)
1013 {
1014   ToolkitTestApplication application;
1015   tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1016
1017   TextLabel label = TextLabel::New("Hello world");
1018   DALI_TEST_CHECK( label );
1019
1020   // Avoid a crash when core load gl resources.
1021   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1022
1023   Stage::GetCurrent().Add( label );
1024
1025   // Turn on all the effects
1026   label.SetAnchorPoint( AnchorPoint::CENTER );
1027   label.SetParentOrigin( ParentOrigin::CENTER );
1028   label.SetSize( 360.0f, 10.f );
1029
1030   try
1031   {
1032     // Render the text.
1033     application.SendNotification();
1034     application.Render();
1035   }
1036   catch( ... )
1037   {
1038     tet_result(TET_FAIL);
1039   }
1040
1041   label.SetProperty( TextLabel::Property::TEXT, "Hello world                                        " );
1042   label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1043   label.SetSize( 400.0f, 10.f );
1044
1045   try
1046   {
1047     // Render the text.
1048     application.SendNotification();
1049     application.Render();
1050   }
1051   catch( ... )
1052   {
1053     tet_result(TET_FAIL);
1054   }
1055
1056
1057   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1058   label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1059   label.SetSize( 400.0f, 10.f );
1060
1061   try
1062   {
1063     // Render the text.
1064     application.SendNotification();
1065     application.Render();
1066   }
1067   catch( ... )
1068   {
1069     tet_result(TET_FAIL);
1070   }
1071
1072   END_TEST;
1073 }
1074
1075 int UtcDaliToolkitTextlabelTextWrapMode(void)
1076 {
1077   ToolkitTestApplication application;
1078   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1079
1080   int lineCount =0 ;
1081
1082   TextLabel label = TextLabel::New();
1083   label.SetSize( 300.0f, 300.f );
1084   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1085   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1086
1087
1088
1089   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1090   Stage::GetCurrent().Add( label );
1091
1092   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1093   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1094
1095   application.SendNotification();
1096   application.Render();
1097
1098   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1099   DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1100
1101   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1102   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1103
1104   application.SendNotification();
1105   application.Render();
1106
1107   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1108   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1109
1110   application.SendNotification();
1111   application.Render();
1112
1113   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1114   DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1115
1116   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1117   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1118
1119   application.SendNotification();
1120   application.Render();
1121
1122   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1123   DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
1124
1125   tet_infoline( "Ensure invalid string does not change wrapping mode" );
1126   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1127   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1128
1129   END_TEST;
1130 }
1131
1132 int UtcDaliToolkitTextLabelColorComponents(void)
1133 {
1134   ToolkitTestApplication application;
1135
1136   TextLabel label = TextLabel::New();
1137   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1138   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   1.0f, TEST_LOCATION );
1139   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1140   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1141   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1142
1143   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1144   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1145   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1146   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1147   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1148
1149   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1150   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1151   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1152   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  1.0f, TEST_LOCATION );
1153   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1154
1155   label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1156   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1157   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1158   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1159
1160   // Test a transparent text - Rendering should be skipped.
1161   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1162   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1163
1164   Stage::GetCurrent().Add( label );
1165
1166   TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1167   drawTrace.Enable( true );
1168
1169   application.SendNotification();
1170   application.Render();
1171
1172   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION );  // Should be rendered
1173
1174   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1175
1176   drawTrace.Reset();
1177
1178   application.SendNotification();
1179   application.Render();
1180
1181   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1182
1183   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1184
1185   drawTrace.Reset();
1186
1187   application.SendNotification();
1188   application.Render();
1189
1190   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1191
1192   END_TEST;
1193 }
1194
1195 int UtcDaliToolkitTextlabelTextStyle01(void)
1196 {
1197   ToolkitTestApplication application;
1198   tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1199
1200   TextLabel label = TextLabel::New();
1201   label.SetSize( 300.0f, 300.f );
1202   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1203   label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1204   Stage::GetCurrent().Add( label );
1205
1206   Property::Map outlineMapSet;
1207   Property::Map outlineMapGet;
1208
1209   outlineMapSet["color"] = Color::BLUE;
1210   outlineMapSet["width"] = 2.0f;
1211   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1212
1213   application.SendNotification();
1214   application.Render();
1215
1216   Property::Map shadowMapSet;
1217   shadowMapSet.Insert( "color", "green" );
1218   shadowMapSet.Insert( "offset", "2 2" );
1219   shadowMapSet.Insert( "blurRadius", "3" );
1220   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1221
1222   outlineMapSet["color"] = Color::RED;
1223   outlineMapSet["width"] = 0.0f;
1224   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1225
1226   application.SendNotification();
1227   application.Render();
1228
1229   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1230
1231   Property::Value* colorValue = outlineMapGet.Find("color");
1232
1233   bool colorMatched( false );
1234
1235   if ( colorValue )
1236   {
1237      Property::Type valueType = colorValue->GetType();
1238
1239      if ( Property::STRING == valueType )
1240      {
1241        std::string stringValue;
1242        colorValue->Get( stringValue );
1243        if (  stringValue == "red" )
1244        {
1245          colorMatched = true;
1246        }
1247      }
1248      else if ( Property::VECTOR4 == valueType )
1249      {
1250        Vector4 colorVector4;
1251        colorValue->Get( colorVector4 );
1252        if (  colorVector4 == Color::RED )
1253        {
1254          colorMatched = true;
1255        }
1256      }
1257   }
1258
1259   DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1260
1261   END_TEST;
1262 }
1263
1264 int UtcDaliToolkitTextlabelMultiline(void)
1265 {
1266   ToolkitTestApplication application;
1267   tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1268
1269   TextLabel label = TextLabel::New();
1270   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1271   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1272   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1273   Stage::GetCurrent().Add( label );
1274
1275   application.SendNotification();
1276   application.Render();
1277
1278   int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1279   DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1280
1281   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1282
1283   application.SendNotification();
1284   application.Render();
1285
1286   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1287   DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1288
1289
1290   END_TEST;
1291 }
1292
1293 int UtcDaliToolkitTextlabelTextDirection(void)
1294 {
1295   ToolkitTestApplication application;
1296   tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1297
1298   TextLabel label = TextLabel::New();
1299   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1300
1301   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1302   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1303   Stage::GetCurrent().Add( label );
1304
1305   // Test LTR text
1306   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1307
1308   // Test RTL text
1309   label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1310   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1311
1312   // Test RTL text starting with weak character
1313   label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1314   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1315
1316   // Test RTL text string with emoji and weak character
1317   label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1318   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1319
1320   END_TEST;
1321 }
1322
1323 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1324 {
1325   ToolkitTestApplication application;
1326   tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1327
1328   TextLabel label = TextLabel::New();
1329
1330   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP  );
1331   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1332   label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1333   label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1334   Stage::GetCurrent().Add( label );
1335   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1336
1337   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE  );
1338   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1339
1340   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM  );
1341   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1342
1343   END_TEST;
1344 }