Remove deprecated APIs in Tizen 3.0
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
1 /*
2  * Copyright (c) 2018 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 expected0(414.f, 192.f, 0.0f);
412     Vector3 expected1(414.f, 252.f, 0.0f);
413     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
414     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
415     DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION);
416     label3.SetProperty(TextLabel::Property::LINE_SPACING, 20);
417     DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION);
418   }
419
420   // single line, line spacing must not affect natural size
421   {
422     const Vector3 expected0(948.f, 64.f, 0.0f);
423     const Vector3 expected1(948.f, 84.f, 0.0f);
424     TextLabel label3 = TextLabel::New("Some text here end there end here");
425     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
426     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
427     DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION);
428     label3.SetProperty(TextLabel::Property::LINE_SPACING, 20);
429     DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION);
430   }
431   // Check the line spacing property
432   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
433   label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
434   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
435
436   // Check the underline property
437   underlineMapSet.Clear();
438   underlineMapSet.Insert( "enable", "true" );
439   underlineMapSet.Insert( "color", "red" );
440   underlineMapSet.Insert( "height", "1" );
441
442   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
443
444   application.SendNotification();
445   application.Render();
446
447   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
448   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
449   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
450
451   underlineMapSet.Clear();
452
453   Property::Map underlineDisabledMapGet;
454   underlineDisabledMapGet.Insert( "enable", "false" );
455   underlineDisabledMapGet.Insert( "color", "red" );
456   underlineDisabledMapGet.Insert( "height", "1" );
457
458   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
459   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
460   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
461   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
462
463   // Check the shadow property
464
465   Property::Map shadowMapSet;
466   Property::Map shadowMapGet;
467
468   shadowMapSet.Insert( "color", Color::GREEN );
469   shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
470   shadowMapSet.Insert( "blurRadius", 5.0f );
471
472   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
473
474   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
475   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
476   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
477
478   shadowMapSet.Clear();
479   Property::Map shadowDisabledMapGet;
480   shadowDisabledMapGet.Insert( "color", Color::GREEN );
481   shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
482   shadowDisabledMapGet.Insert( "blurRadius", 5.0f );
483
484   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
485
486   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
487   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
488   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
489
490   // Check the emboss property
491   label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
492   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
493
494   // Check the outline property
495
496   // Test string type first
497   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
498   label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
499   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
500
501   // Then test the property map type
502   Property::Map outlineMapSet;
503   Property::Map outlineMapGet;
504
505   outlineMapSet["color"] = Color::RED;
506   outlineMapSet["width"] = 2.0f;
507   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
508
509   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
510   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
511   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
512
513   // Check the background property
514   Property::Map backgroundMapSet;
515   Property::Map backgroundMapGet;
516
517   backgroundMapSet["enable"] = true;
518   backgroundMapSet["color"] = Color::RED;
519   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
520
521   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
522   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
523   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
524
525   // Check the pixel size of font
526   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
527   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
528
529   // Check the ellipsis property
530   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
531   label.SetProperty( TextLabel::Property::ELLIPSIS, false );
532   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
533
534   // Check the layout direction property
535   label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
536   DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
537
538   application.SendNotification();
539   application.Render();
540
541   END_TEST;
542 }
543
544 int UtcDaliToolkitTextlabelAtlasRenderP(void)
545 {
546   ToolkitTestApplication application;
547   tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
548   TextLabel label = TextLabel::New("Test Text");
549   DALI_TEST_CHECK( label );
550
551   // Avoid a crash when core load gl resources.
552   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
553
554   Stage::GetCurrent().Add( label );
555
556   // Turn on all the effects
557   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
558   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
559
560   Property::Map underlineMap;
561   underlineMap.Insert( "enable", "true" );
562   underlineMap.Insert( "color", "red" );
563   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
564
565   Property::Map shadowMap;
566   shadowMap.Insert( "color", Color::BLUE );
567   shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
568   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
569
570   try
571   {
572     // Render some text with the shared atlas backend
573     label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
574     application.SendNotification();
575     application.Render();
576   }
577   catch( ... )
578   {
579     tet_result(TET_FAIL);
580   }
581
582   try
583   {
584     // Render some text with the shared atlas backend
585     label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_VECTOR_BASED );
586     application.SendNotification();
587     application.Render();
588   }
589   catch( ... )
590   {
591     tet_result(TET_FAIL);
592   }
593   END_TEST;
594 }
595
596 int UtcDaliToolkitTextLabelLanguagesP(void)
597 {
598   ToolkitTestApplication application;
599   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
600   TextLabel label = TextLabel::New();
601   DALI_TEST_CHECK( label );
602
603   Stage::GetCurrent().Add( label );
604
605   const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
606                              "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
607                              "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
608                              "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
609                              "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
610                              "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
611
612   label.SetProperty( TextLabel::Property::TEXT, scripts );
613   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
614
615   application.SendNotification();
616   application.Render();
617
618   END_TEST;
619 }
620
621 int UtcDaliToolkitTextLabelEmojisP(void)
622 {
623   ToolkitTestApplication application;
624   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
625   TextLabel label = TextLabel::New();
626   DALI_TEST_CHECK( label );
627
628   Stage::GetCurrent().Add( label );
629
630   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
631
632   char* pathNamePtr = get_current_dir_name();
633   const std::string pathName( pathNamePtr );
634   free( pathNamePtr );
635
636   TextAbstraction::FontDescription fontDescription;
637   fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
638   fontDescription.family = "BreezeColorEmoji";
639   fontDescription.width = TextAbstraction::FontWidth::NONE;
640   fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
641   fontDescription.slant = TextAbstraction::FontSlant::NONE;
642
643   fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
644
645   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>";
646   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
647   label.SetProperty( TextLabel::Property::TEXT, emojis );
648
649   Property::Map shadowMap;
650   shadowMap.Insert( "color", "green" );
651   shadowMap.Insert( "offset", "2 2" );
652   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
653
654   application.SendNotification();
655   application.Render();
656
657   END_TEST;
658 }
659
660 int UtcDaliToolkitTextlabelScrollingP(void)
661 {
662   ToolkitTestApplication application;
663   tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
664   TextLabel labelImmediate = TextLabel::New("Some text to scroll");
665   TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
666
667   DALI_TEST_CHECK( labelImmediate );
668   DALI_TEST_CHECK( labelFinished );
669   // Avoid a crash when core load gl resources.
670   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
671   Stage::GetCurrent().Add( labelImmediate );
672   // Turn on all the effects
673   labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
674   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
675   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
676   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
677   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
678
679   Stage::GetCurrent().Add( labelFinished );
680   // Turn on all the effects
681   labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
682   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
683   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
684   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
685   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
686
687
688
689   try
690   {
691     // Render some text with the shared atlas backend
692     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
693     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
694
695     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
696     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
697
698     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
699     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
700     application.SendNotification();
701     application.Render();
702
703     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
704     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
705     application.SendNotification();
706     application.Render();
707
708   }
709   catch( ... )
710   {
711     tet_result(TET_FAIL);
712   }
713
714   END_TEST;
715 }
716
717 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
718 {
719   ToolkitTestApplication application;
720   TextLabel labelShort = TextLabel::New("Some text to scroll");
721   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!");
722
723   DALI_TEST_CHECK( labelShort );
724   DALI_TEST_CHECK( labelLong );
725   // Avoid a crash when core load gl resources.
726   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
727   Stage::GetCurrent().Add( labelShort );
728   // Turn on all the effects
729   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
730   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
731   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
732   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
733   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
734   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
735
736   Stage::GetCurrent().Add( labelLong );
737   // Turn on all the effects
738   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
739   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
740   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
741   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
742   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
743   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
744
745   try
746   {
747     // Render some text with the shared atlas backend
748     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
749     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
750     application.SendNotification();
751     application.Render();
752
753     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
754     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
755     application.SendNotification();
756     application.Render();
757
758   }
759   catch( ... )
760   {
761     tet_result(TET_FAIL);
762   }
763
764   END_TEST;
765 }
766
767 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
768 {
769   ToolkitTestApplication application;
770   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
771   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
772
773   DALI_TEST_CHECK( labelShort );
774   DALI_TEST_CHECK( labelLong );
775   // Avoid a crash when core load gl resources.
776   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
777   Stage::GetCurrent().Add( labelShort );
778   // Turn on all the effects
779   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
780   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
781   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
782   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
783   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
784   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
785
786   Stage::GetCurrent().Add( labelLong );
787   // Turn on all the effects
788   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
789   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
790   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
791   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
792   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
793   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
794
795   try
796   {
797     // Render some text with the shared atlas backend
798     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
799     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
800     application.SendNotification();
801     application.Render();
802
803     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
804     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
805     application.SendNotification();
806     application.Render();
807
808   }
809   catch( ... )
810   {
811     tet_result(TET_FAIL);
812   }
813
814   END_TEST;
815 }
816
817 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
818 {
819   ToolkitTestApplication application;
820   TextLabel labelShort = TextLabel::New("Some text to scroll");
821   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!");
822
823   DALI_TEST_CHECK( labelShort );
824   DALI_TEST_CHECK( labelLong );
825   // Avoid a crash when core load gl resources.
826   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
827   Stage::GetCurrent().Add( labelShort );
828   // Turn on all the effects
829   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
830   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
831   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
832   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
833   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
834   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
835
836   Stage::GetCurrent().Add( labelLong );
837   // Turn on all the effects
838   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
839   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
840   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
841   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
842   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
843   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
844
845   try
846   {
847     // Render some text with the shared atlas backend
848     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
849     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
850     application.SendNotification();
851     application.Render();
852
853     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
854     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
855     application.SendNotification();
856     application.Render();
857
858   }
859   catch( ... )
860   {
861     tet_result(TET_FAIL);
862   }
863
864   END_TEST;
865 }
866
867 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
868 {
869   ToolkitTestApplication application;
870   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
871   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
872
873   DALI_TEST_CHECK( labelShort );
874   DALI_TEST_CHECK( labelLong );
875   // Avoid a crash when core load gl resources.
876   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
877   Stage::GetCurrent().Add( labelShort );
878   // Turn on all the effects
879   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
880   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
881   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
882   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
883   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
884   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
885
886   Stage::GetCurrent().Add( labelLong );
887   // Turn on all the effects
888   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
889   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
890   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
891   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
892   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
893   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
894
895   try
896   {
897     // Render some text with the shared atlas backend
898     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
899     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
900     application.SendNotification();
901     application.Render();
902
903     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
904     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
905     application.SendNotification();
906     application.Render();
907
908   }
909   catch( ... )
910   {
911     tet_result(TET_FAIL);
912   }
913
914   END_TEST;
915 }
916
917 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
918 {
919   ToolkitTestApplication application;
920   tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
921   TextLabel label = TextLabel::New("Some text to scroll");
922   DALI_TEST_CHECK( label );
923   // Avoid a crash when core load gl resources.
924   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
925   Stage::GetCurrent().Add( label );
926   label.SetSize( 360.0f, 20.f );
927   // Turn on all the effects
928   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
929   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
930   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
931   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
932
933   // Render the text.
934   application.SendNotification();
935   application.Render();
936
937   unsigned int actorCount1 = label.GetChildCount();
938   tet_printf("Initial actor count is(%d)\n", actorCount1 );
939
940   try
941   {
942     // Render some text with the shared atlas backend
943     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
944     application.SendNotification();
945     application.Render(2000);
946
947     unsigned int actorCount1 = label.GetChildCount();
948     tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
949
950     label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
951
952     // Render the text.
953     application.SendNotification();
954     application.Render();
955
956     unsigned int actorCount2 = label.GetChildCount();
957     tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
958
959     DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
960
961   }
962   catch( ... )
963   {
964     tet_result(TET_FAIL);
965   }
966
967   END_TEST;
968 }
969
970 int UtcDaliToolkitTextlabelScrollingN(void)
971 {
972   ToolkitTestApplication application;
973   tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
974
975   TextLabel label = TextLabel::New("Some text to scroll");
976   DALI_TEST_CHECK( label );
977
978   Stage::GetCurrent().Add( label );
979
980   // Avoid a crash when core load gl resources.
981   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
982
983   // The text scrolling works only on single line text.
984   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
985
986   // Turn on all the effects.
987   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
988   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
989   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
990
991   // Enable the auto scrolling effect.
992   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
993
994   // The auto scrolling shouldn't be enabled.
995   const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
996   DALI_TEST_CHECK( !enabled );
997
998   END_TEST;
999 }
1000
1001 int UtcDaliToolkitTextlabelEllipsis(void)
1002 {
1003   ToolkitTestApplication application;
1004   tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1005
1006   TextLabel label = TextLabel::New("Hello world");
1007   DALI_TEST_CHECK( label );
1008
1009   // Avoid a crash when core load gl resources.
1010   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1011
1012   Stage::GetCurrent().Add( label );
1013
1014   // Turn on all the effects
1015   label.SetAnchorPoint( AnchorPoint::CENTER );
1016   label.SetParentOrigin( ParentOrigin::CENTER );
1017   label.SetSize( 360.0f, 10.f );
1018
1019   try
1020   {
1021     // Render the text.
1022     application.SendNotification();
1023     application.Render();
1024   }
1025   catch( ... )
1026   {
1027     tet_result(TET_FAIL);
1028   }
1029
1030   label.SetProperty( TextLabel::Property::TEXT, "Hello world                                        " );
1031   label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1032   label.SetSize( 400.0f, 10.f );
1033
1034   try
1035   {
1036     // Render the text.
1037     application.SendNotification();
1038     application.Render();
1039   }
1040   catch( ... )
1041   {
1042     tet_result(TET_FAIL);
1043   }
1044
1045
1046   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1047   label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1048   label.SetSize( 400.0f, 10.f );
1049
1050   try
1051   {
1052     // Render the text.
1053     application.SendNotification();
1054     application.Render();
1055   }
1056   catch( ... )
1057   {
1058     tet_result(TET_FAIL);
1059   }
1060
1061   END_TEST;
1062 }
1063
1064 int UtcDaliToolkitTextlabelTextWrapMode(void)
1065 {
1066   ToolkitTestApplication application;
1067   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1068
1069   int lineCount =0 ;
1070
1071   TextLabel label = TextLabel::New();
1072   label.SetSize( 300.0f, 300.f );
1073   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1074   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1075
1076
1077
1078   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1079   Stage::GetCurrent().Add( label );
1080
1081   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1082   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1083
1084   application.SendNotification();
1085   application.Render();
1086
1087   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1088   DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1089
1090   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1091   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1092
1093   application.SendNotification();
1094   application.Render();
1095
1096   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1097   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1098
1099   application.SendNotification();
1100   application.Render();
1101
1102   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1103   DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1104
1105   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1106   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1107
1108   application.SendNotification();
1109   application.Render();
1110
1111   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1112   DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
1113
1114   tet_infoline( "Ensure invalid string does not change wrapping mode" );
1115   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1116   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1117
1118   END_TEST;
1119 }
1120
1121 int UtcDaliToolkitTextLabelColorComponents(void)
1122 {
1123   ToolkitTestApplication application;
1124
1125   TextLabel label = TextLabel::New();
1126   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1127   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   1.0f, TEST_LOCATION );
1128   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1129   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1130   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1131
1132   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1133   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1134   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1135   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1136   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1137
1138   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1139   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1140   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1141   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  1.0f, TEST_LOCATION );
1142   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1143
1144   label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1145   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1146   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1147   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1148
1149   // Test a transparent text - Rendering should be skipped.
1150   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1151   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1152
1153   Stage::GetCurrent().Add( label );
1154
1155   TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1156   drawTrace.Enable( true );
1157
1158   application.SendNotification();
1159   application.Render();
1160
1161   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION );  // Should be rendered
1162
1163   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1164
1165   drawTrace.Reset();
1166
1167   application.SendNotification();
1168   application.Render();
1169
1170   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1171
1172   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1173
1174   drawTrace.Reset();
1175
1176   application.SendNotification();
1177   application.Render();
1178
1179   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1180
1181   END_TEST;
1182 }
1183
1184 int UtcDaliToolkitTextlabelTextStyle01(void)
1185 {
1186   ToolkitTestApplication application;
1187   tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1188
1189   TextLabel label = TextLabel::New();
1190   label.SetSize( 300.0f, 300.f );
1191   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1192   label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1193   Stage::GetCurrent().Add( label );
1194
1195   Property::Map outlineMapSet;
1196   Property::Map outlineMapGet;
1197
1198   outlineMapSet["color"] = Color::BLUE;
1199   outlineMapSet["width"] = 2.0f;
1200   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1201
1202   application.SendNotification();
1203   application.Render();
1204
1205   Property::Map shadowMapSet;
1206   shadowMapSet.Insert( "color", "green" );
1207   shadowMapSet.Insert( "offset", "2 2" );
1208   shadowMapSet.Insert( "blurRadius", "3" );
1209   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1210
1211   outlineMapSet["color"] = Color::RED;
1212   outlineMapSet["width"] = 0.0f;
1213   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1214
1215   application.SendNotification();
1216   application.Render();
1217
1218   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1219
1220   Property::Value* colorValue = outlineMapGet.Find("color");
1221
1222   bool colorMatched( false );
1223
1224   if ( colorValue )
1225   {
1226      Property::Type valueType = colorValue->GetType();
1227
1228      if ( Property::STRING == valueType )
1229      {
1230        std::string stringValue;
1231        colorValue->Get( stringValue );
1232        if (  stringValue == "red" )
1233        {
1234          colorMatched = true;
1235        }
1236      }
1237      else if ( Property::VECTOR4 == valueType )
1238      {
1239        Vector4 colorVector4;
1240        colorValue->Get( colorVector4 );
1241        if (  colorVector4 == Color::RED )
1242        {
1243          colorMatched = true;
1244        }
1245      }
1246   }
1247
1248   DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1249
1250   END_TEST;
1251 }
1252
1253 int UtcDaliToolkitTextlabelMultiline(void)
1254 {
1255   ToolkitTestApplication application;
1256   tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1257
1258   TextLabel label = TextLabel::New();
1259   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1260   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1261   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1262   Stage::GetCurrent().Add( label );
1263
1264   application.SendNotification();
1265   application.Render();
1266
1267   int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1268   DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1269
1270   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1271
1272   application.SendNotification();
1273   application.Render();
1274
1275   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1276   DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1277
1278
1279   END_TEST;
1280 }
1281
1282 int UtcDaliToolkitTextlabelTextDirection(void)
1283 {
1284   ToolkitTestApplication application;
1285   tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1286
1287   TextLabel label = TextLabel::New();
1288   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1289
1290   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1291   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1292   Stage::GetCurrent().Add( label );
1293
1294   // Test LTR text
1295   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1296
1297   // Test RTL text
1298   label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1299   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1300
1301   // Test RTL text starting with weak character
1302   label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1303   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1304
1305   // Test RTL text string with emoji and weak character
1306   label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1307   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1308
1309   END_TEST;
1310 }
1311
1312 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1313 {
1314   ToolkitTestApplication application;
1315   tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1316
1317   TextLabel label = TextLabel::New();
1318
1319   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP  );
1320   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1321   label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1322   label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1323   Stage::GetCurrent().Add( label );
1324   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1325
1326   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE  );
1327   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1328
1329   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM  );
1330   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1331
1332   END_TEST;
1333 }