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