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