Fix the build fail of toolkit-test-util
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20 #include <unistd.h>
21
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
25 #include <dali-toolkit/devel-api/controls/text-controls/text-style-properties-devel.h>
26 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
27 #include <dali/devel-api/text-abstraction/bitmap-font.h>
28 #include <dali/devel-api/text-abstraction/font-client.h>
29 #include <dali/devel-api/adaptor-framework/image-loading.h>
30 #include <dali-toolkit/devel-api/text/bitmap-font.h>
31 #include <dali-toolkit/devel-api/text/rendering-backend.h>
32 #include <dali-toolkit/devel-api/text/text-utils-devel.h>
33
34 using namespace Dali;
35 using namespace Toolkit;
36
37 void dali_textlabel_startup(void)
38 {
39   test_return_value = TET_UNDEF;
40 }
41
42 void dali_textlabel_cleanup(void)
43 {
44   test_return_value = TET_PASS;
45 }
46
47 namespace
48 {
49
50 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
51 const char* const PROPERTY_NAME_TEXT = "text";
52 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
53 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
54 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
55 const char* const PROPERTY_NAME_MULTI_LINE =  "multiLine";
56 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
57 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
58 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
59 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
60 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
61 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
62 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
63 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
64
65 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
66 const char* const PROPERTY_NAME_UNDERLINE = "underline";
67 const char* const PROPERTY_NAME_SHADOW = "shadow";
68 const char* const PROPERTY_NAME_EMBOSS = "emboss";
69 const char* const PROPERTY_NAME_OUTLINE = "outline";
70 const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
71
72 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
73 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
74 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
75 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
76
77 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
78 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
79
80 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
81 {
82   const Property::Map::SizeType size = mapGet.Count();
83
84   if( size == mapSet.Count() )
85   {
86     for( unsigned int index = 0u; index < size; ++index )
87     {
88       const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
89
90       // Find the keys of the 'get' map
91       Property::Index indexKey = valueGet.first.indexKey;
92       std::string stringKey = valueGet.first.stringKey;
93
94       if( !indexConversionTable.empty() )
95       {
96         if( stringKey.empty() )
97         {
98           stringKey = indexConversionTable[ indexKey ];
99         }
100
101         if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
102         {
103           Property::Index index = 0u;
104           for( auto key : indexConversionTable )
105           {
106             if( key == stringKey )
107             {
108               indexKey = index;
109               break;
110             }
111             ++index;
112           }
113         }
114       }
115
116       const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
117
118       if( nullptr != valueSet )
119       {
120         if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
121         {
122           tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
123           return false;
124         }
125         else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
126         {
127           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
128           return false;
129         }
130         else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
131         {
132           tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
133           return false;
134         }
135         else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
136         {
137           tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
138           return false;
139         }
140         else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
141         {
142           Vector2 vector2Get = valueGet.second.Get<Vector2>();
143           Vector2 vector2Set = valueSet->Get<Vector2>();
144           tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
145           return false;
146         }
147         else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
148         {
149           Vector4 vector4Get = valueGet.second.Get<Vector4>();
150           Vector4 vector4Set = valueSet->Get<Vector4>();
151           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 );
152           return false;
153         }
154       }
155       else
156       {
157         if ( valueGet.first.type == Property::Key::INDEX )
158         {
159           tet_printf( "  The key %d doesn't exist.", valueGet.first.indexKey );
160         }
161         else
162         {
163           tet_printf( "  The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
164         }
165         return false;
166       }
167     }
168   }
169
170   return true;
171 }
172
173 } // namespace
174
175 int UtcDaliToolkitTextLabelConstructorP(void)
176 {
177   ToolkitTestApplication application;
178   tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
179   TextLabel textLabel;
180   DALI_TEST_CHECK( !textLabel );
181   END_TEST;
182 }
183
184 int UtcDaliToolkitTextLabelNewP(void)
185 {
186   ToolkitTestApplication application;
187   tet_infoline(" UtcDaliToolkitTextLabelNewP");
188   TextLabel textLabel = TextLabel::New( "Test Text" );
189   DALI_TEST_CHECK( textLabel );
190   END_TEST;
191 }
192
193 int UtcDaliToolkitTextLabelDownCastP(void)
194 {
195   ToolkitTestApplication application;
196   tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
197   TextLabel textLabel1 = TextLabel::New();
198   BaseHandle object( textLabel1 );
199
200   TextLabel textLabel2 = TextLabel::DownCast( object );
201   DALI_TEST_CHECK( textLabel2 );
202
203   TextLabel textLabel3 = DownCast< TextLabel >( object );
204   DALI_TEST_CHECK( textLabel3 );
205   END_TEST;
206 }
207
208 int UtcDaliToolkitTextLabelDownCastN(void)
209 {
210   ToolkitTestApplication application;
211   tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
212   BaseHandle uninitializedObject;
213   TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
214   DALI_TEST_CHECK( !textLabel1 );
215
216   TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
217   DALI_TEST_CHECK( !textLabel2 );
218   END_TEST;
219 }
220
221 int UtcDaliToolkitTextLabelCopyConstructorP(void)
222 {
223   ToolkitTestApplication application;
224   tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
225   TextLabel textLabel = TextLabel::New();
226   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
227
228   TextLabel copy( textLabel );
229   DALI_TEST_CHECK( copy );
230   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
231   END_TEST;
232 }
233
234 int UtcDaliTextLabelMoveConstructor(void)
235 {
236   ToolkitTestApplication application;
237
238   TextLabel textLabel = TextLabel::New();
239   textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
240   DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
241
242   TextLabel moved = std::move( textLabel );
243   DALI_TEST_CHECK( moved );
244   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
245   DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
246   DALI_TEST_CHECK( !textLabel );
247
248   END_TEST;
249 }
250
251 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
252 {
253   ToolkitTestApplication application;
254   tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
255   TextLabel textLabel = TextLabel::New();
256   textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
257
258   TextLabel copy = textLabel;
259   DALI_TEST_CHECK( copy );
260   DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
261   END_TEST;
262 }
263
264 int UtcDaliTextLabelMoveAssignment(void)
265 {
266   ToolkitTestApplication application;
267
268   TextLabel textLabel = TextLabel::New();
269   textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
270   DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
271
272   TextLabel moved;
273   moved = std::move( textLabel );
274   DALI_TEST_CHECK( moved );
275   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
276   DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
277   DALI_TEST_CHECK( !textLabel );
278
279   END_TEST;
280 }
281
282 // Positive test case for a method
283 int UtcDaliToolkitTextLabelGetPropertyP(void)
284 {
285   ToolkitTestApplication application;
286   tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
287   TextLabel label = TextLabel::New("Test Text");
288   DALI_TEST_CHECK( label );
289
290   // Check Property Indices are correct
291   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == DevelTextLabel::Property::RENDERING_BACKEND );
292   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
293   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
294   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
295   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
296   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
297   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
298   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
299   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
300   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
301   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
302   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
303   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
304   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
305   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
306   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
307   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
308   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
309   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
310   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
311   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
312   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
313   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
314   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
315
316   END_TEST;
317 }
318
319 int UtcDaliToolkitTextLabelSetPropertyP(void)
320 {
321   ToolkitTestApplication application;
322   tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
323   TextLabel label = TextLabel::New();
324   DALI_TEST_CHECK( label );
325
326   application.GetScene().Add( label );
327
328   // Note - we can't check the defaults since the stylesheets are platform-specific
329   label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
330   DALI_TEST_EQUALS( (DevelText::RenderingType)label.GetProperty<int>( DevelTextLabel::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION );
331
332   // Check that text can be correctly reset
333   label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
334   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
335
336   // Check font properties.
337   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
338   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
339
340   Property::Map fontStyleMapSet;
341   Property::Map fontStyleMapGet;
342
343   fontStyleMapSet.Insert( "weight", "bold" );
344   fontStyleMapSet.Insert( "width", "condensed" );
345   fontStyleMapSet.Insert( "slant", "italic" );
346   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
347
348   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
349   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
350   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
351
352   // Check the old font style format.
353   fontStyleMapSet.Clear();
354   fontStyleMapSet.Insert( "weight", "thin" );
355   fontStyleMapSet.Insert( "width", "expanded" );
356   fontStyleMapSet.Insert( "slant", "oblique" );
357   const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
358
359   label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
360   std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
361   DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
362
363   label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
364   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
365
366   label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 2.5f );
367   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
368   label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
369
370   // Reset font style.
371   fontStyleMapSet.Clear();
372   fontStyleMapSet.Insert( "weight", "normal" );
373   fontStyleMapSet.Insert( "slant", "oblique" );
374
375   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
376   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
377   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
378   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
379
380   fontStyleMapSet.Clear();
381   fontStyleMapSet.Insert( "slant", "roman" );
382
383   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
384   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
385   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
386
387   // Replace 'roman' for 'normal'.
388   Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
389   if( NULL != slantValue )
390   {
391     if( "normal" == slantValue->Get<std::string>() )
392     {
393       fontStyleMapGet["slant"] = "roman";
394     }
395   }
396   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
397
398   fontStyleMapSet.Clear();
399
400   label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
401   fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
402   DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
403   DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
404
405   // Toggle multi-line
406   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
407   DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
408
409   // Check that the Alignment properties can be correctly set
410   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
411   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
412   label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
413   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
414
415   // Check that text color can be properly set
416   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
417   DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
418
419   Property::Map underlineMapSet;
420   Property::Map underlineMapGet;
421
422   underlineMapSet.Insert( "enable", false );
423   underlineMapSet.Insert( "color", Color::BLUE );
424   underlineMapSet.Insert( "height", 0 );
425
426   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
427   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
428   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
429
430   TextLabel label2 = TextLabel::New( "New text" );
431   DALI_TEST_CHECK( label2 );
432   DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
433
434   // Check the enable markup property.
435   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
436   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
437   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
438
439   // Check the text property when markup is enabled
440   label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
441   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
442
443   // Check for incomplete marks.
444   label.SetProperty( TextLabel::Property::TEXT, "<color='white'><i>Markup</i><b>Text</b></color>" );
445   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
446   try
447   {
448     application.SendNotification();
449     application.Render();
450   }
451   catch( ... )
452   {
453     tet_result(TET_FAIL);
454   }
455
456   // Check autoscroll properties
457   const int SCROLL_SPEED = 80;
458   const int SCROLL_LOOPS = 4;
459   const float SCROLL_GAP = 50.0f;
460   const float SCROLL_LOOP_DELAY = 0.3f;
461   const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
462   const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
463
464   label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
465   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
466   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
467   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
468   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
469   DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
470   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
471   DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
472   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
473   DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
474   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
475   DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
476
477   //Check autoscroll stop type property
478   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
479   DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
480
481   label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
482   DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
483
484   // test natural size with multi-line and line spacing
485   {
486     TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
487     Vector3 oneLineNaturalSize = label3.GetNaturalSize();
488     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
489     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
490     Vector3 multiLineNaturalSize = label3.GetNaturalSize();
491
492     // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
493     // The height of the text when multi-line is enabled will be larger
494     DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
495     DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
496
497     // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
498     // Everything else will remain the same
499     int lineSpacing = 20;
500     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
501     Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
502     expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
503     DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
504   }
505
506   // single line, line spacing must not affect natural size of the text, only add the spacing to the height
507   {
508     TextLabel label3 = TextLabel::New("Some text here end there end here");
509     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
510     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
511     Vector3 textNaturalSize = label3.GetNaturalSize();
512     int lineSpacing = 20;
513     label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
514     Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
515     expectedNaturalSizeWithLineSpacing.height += lineSpacing;
516     DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
517   }
518   // Check the line spacing property
519   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
520   label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
521   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
522
523   // Check the underline property
524   underlineMapSet.Clear();
525   underlineMapSet.Insert( "enable", true );
526   underlineMapSet.Insert( "color", Color::RED );
527   underlineMapSet.Insert( "height", 1 );
528
529   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
530
531   application.SendNotification();
532   application.Render();
533
534   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
535   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
536   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
537
538   underlineMapSet.Clear();
539   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true );
540   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN );
541   underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 );
542
543   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
544
545   application.SendNotification();
546   application.Render();
547
548   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
549   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
550   std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
551   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
552
553   underlineMapSet.Clear();
554
555   Property::Map underlineDisabledMapGet;
556   underlineDisabledMapGet.Insert( "enable", false );
557   underlineDisabledMapGet.Insert( "color", Color::GREEN );
558   underlineDisabledMapGet.Insert( "height", 2 );
559
560   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
561
562   application.SendNotification();
563   application.Render();
564
565   underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
566   DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
567   DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
568
569   // Check the shadow property
570
571   Property::Map shadowMapSet;
572   Property::Map shadowMapGet;
573
574   shadowMapSet.Insert( "color", Color::GREEN );
575   shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
576   shadowMapSet.Insert( "blurRadius", 5.0f );
577
578   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
579
580   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
581   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
582   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
583
584   shadowMapSet.Clear();
585
586   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
587   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
588   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
589
590   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
591
592   // Replace the offset (string) by a vector2
593   shadowMapSet.Clear();
594   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
595   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
596   shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
597
598   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
599   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
600   std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
601   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
602
603   shadowMapSet.Clear();
604   Property::Map shadowDisabledMapGet;
605   shadowDisabledMapGet.Insert( "color", Color::BLUE );
606   shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
607   shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
608
609   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
610
611   shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
612   DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
613   DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
614
615   // Check the emboss property
616   label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
617   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
618
619   // Check the outline property
620
621   // Test string type first
622   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
623   label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
624   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
625
626   // Then test the property map type
627   Property::Map outlineMapSet;
628   Property::Map outlineMapGet;
629
630   outlineMapSet["color"] = Color::RED;
631   outlineMapSet["width"] = 2.0f;
632   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
633
634   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
635   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
636   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
637
638   outlineMapSet.Clear();
639   outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
640   outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
641   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
642
643   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
644   DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
645   std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
646   DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
647
648   // Check the background property
649   Property::Map backgroundMapSet;
650   Property::Map backgroundMapGet;
651
652   backgroundMapSet["enable"] = true;
653   backgroundMapSet["color"] = Color::RED;
654   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
655
656   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
657   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
658   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
659
660   backgroundMapSet.Clear();
661   backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
662   backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
663   label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
664
665   backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
666   DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
667   std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
668   DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
669
670   // Check the pixel size of font
671   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
672   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
673
674   // Check the ellipsis property
675   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
676   label.SetProperty( TextLabel::Property::ELLIPSIS, false );
677   DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
678
679   // Check the layout direction property
680   label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
681   DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
682
683   // Check the line size property
684   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
685   label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f );
686   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
687
688   application.SendNotification();
689   application.Render();
690
691   END_TEST;
692 }
693
694 int UtcDaliToolkitTextlabelAtlasRenderP(void)
695 {
696   ToolkitTestApplication application;
697   tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
698   TextLabel label = TextLabel::New("Test Text");
699   DALI_TEST_CHECK( label );
700
701   // Avoid a crash when core load gl resources.
702   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
703
704   application.GetScene().Add( label );
705
706   // Turn on all the effects
707   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
708   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
709
710   Property::Map underlineMap;
711   underlineMap.Insert( "enable", true );
712   underlineMap.Insert( "color", Color::RED );
713   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
714
715   Property::Map shadowMap;
716   shadowMap.Insert( "color", Color::BLUE );
717   shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
718   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
719
720   try
721   {
722     // Render some text with the shared atlas backend
723     label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
724     application.SendNotification();
725     application.Render();
726   }
727   catch( ... )
728   {
729     tet_result(TET_FAIL);
730   }
731
732   try
733   {
734     // Render some text with the shared atlas backend
735     label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED );
736     application.SendNotification();
737     application.Render();
738   }
739   catch( ... )
740   {
741     tet_result(TET_FAIL);
742   }
743   END_TEST;
744 }
745
746 int UtcDaliToolkitTextLabelLanguagesP(void)
747 {
748   ToolkitTestApplication application;
749   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
750   TextLabel label = TextLabel::New();
751   DALI_TEST_CHECK( label );
752
753   application.GetScene().Add( label );
754
755   const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
756                              "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
757                              "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
758                              "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
759                              "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
760                              "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
761
762   label.SetProperty( TextLabel::Property::TEXT, scripts );
763   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
764
765   application.SendNotification();
766   application.Render();
767
768   END_TEST;
769 }
770
771 int UtcDaliToolkitTextLabelEmojisP(void)
772 {
773   ToolkitTestApplication application;
774   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
775   TextLabel label = TextLabel::New();
776   DALI_TEST_CHECK( label );
777
778   application.GetScene().Add( label );
779
780   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
781
782   char* pathNamePtr = get_current_dir_name();
783   const std::string pathName( pathNamePtr );
784   free( pathNamePtr );
785
786   TextAbstraction::FontDescription fontDescription;
787   fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
788   fontDescription.family = "BreezeColorEmoji";
789   fontDescription.width = TextAbstraction::FontWidth::NONE;
790   fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
791   fontDescription.slant = TextAbstraction::FontSlant::NONE;
792
793   fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
794
795   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>";
796   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
797   label.SetProperty( TextLabel::Property::TEXT, emojis );
798
799   Property::Map shadowMap;
800   shadowMap.Insert( "color", "green" );
801   shadowMap.Insert( "offset", "2 2" );
802   label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
803
804   application.SendNotification();
805   application.Render();
806
807   END_TEST;
808 }
809
810 int UtcDaliToolkitTextlabelScrollingP(void)
811 {
812   ToolkitTestApplication application;
813   tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
814   TextLabel labelImmediate = TextLabel::New("Some text to scroll");
815   TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
816
817   DALI_TEST_CHECK( labelImmediate );
818   DALI_TEST_CHECK( labelFinished );
819   // Avoid a crash when core load gl resources.
820   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
821   application.GetScene().Add( labelImmediate );
822   // Turn on all the effects
823   labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
824   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
825   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
826   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
827   labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
828
829   application.GetScene().Add( labelFinished );
830   // Turn on all the effects
831   labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
832   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
833   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
834   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
835   labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
836
837
838
839   try
840   {
841     // Render some text with the shared atlas backend
842     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
843     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
844
845     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
846     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
847
848     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
849     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
850     application.SendNotification();
851     application.Render();
852
853     labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
854     labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
855     application.SendNotification();
856     application.Render();
857
858   }
859   catch( ... )
860   {
861     tet_result(TET_FAIL);
862   }
863
864   END_TEST;
865 }
866
867 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
868 {
869   ToolkitTestApplication application;
870   TextLabel labelShort = TextLabel::New("Some text to scroll");
871   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!");
872
873   DALI_TEST_CHECK( labelShort );
874   DALI_TEST_CHECK( labelLong );
875   // Avoid a crash when core load gl resources.
876   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
877   application.GetScene().Add( labelShort );
878   // Turn on all the effects
879   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
880   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
881   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
882   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
883   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
884   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
885
886   application.GetScene().Add( labelLong );
887   // Turn on all the effects
888   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
889   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
890   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
891   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
892   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
893   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
894
895   try
896   {
897     // Render some text with the shared atlas backend
898     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
899     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
900     application.SendNotification();
901     application.Render();
902
903     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
904     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
905     application.SendNotification();
906     application.Render();
907
908   }
909   catch( ... )
910   {
911     tet_result(TET_FAIL);
912   }
913
914   END_TEST;
915 }
916
917 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
918 {
919   ToolkitTestApplication application;
920   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
921   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
922
923   DALI_TEST_CHECK( labelShort );
924   DALI_TEST_CHECK( labelLong );
925   // Avoid a crash when core load gl resources.
926   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
927   application.GetScene().Add( labelShort );
928   // Turn on all the effects
929   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
930   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
931   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
932   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
933   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
934   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
935
936   application.GetScene().Add( labelLong );
937   // Turn on all the effects
938   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
939   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
940   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
941   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
942   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
943   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
944
945   try
946   {
947     // Render some text with the shared atlas backend
948     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
949     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
950     application.SendNotification();
951     application.Render();
952
953     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
954     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
955     application.SendNotification();
956     application.Render();
957
958   }
959   catch( ... )
960   {
961     tet_result(TET_FAIL);
962   }
963
964   END_TEST;
965 }
966
967 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
968 {
969   ToolkitTestApplication application;
970   TextLabel labelShort = TextLabel::New("Some text to scroll");
971   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!");
972
973   DALI_TEST_CHECK( labelShort );
974   DALI_TEST_CHECK( labelLong );
975   // Avoid a crash when core load gl resources.
976   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
977   application.GetScene().Add( labelShort );
978   // Turn on all the effects
979   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
980   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
981   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
982   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
983   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
984   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
985
986   application.GetScene().Add( labelLong );
987   // Turn on all the effects
988   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
989   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
990   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
991   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
992   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
993   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
994
995   try
996   {
997     // Render some text with the shared atlas backend
998     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
999     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1000     application.SendNotification();
1001     application.Render();
1002
1003     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1004     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1005     application.SendNotification();
1006     application.Render();
1007
1008   }
1009   catch( ... )
1010   {
1011     tet_result(TET_FAIL);
1012   }
1013
1014   END_TEST;
1015 }
1016
1017 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
1018 {
1019   ToolkitTestApplication application;
1020   TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1021   TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1022
1023   DALI_TEST_CHECK( labelShort );
1024   DALI_TEST_CHECK( labelLong );
1025   // Avoid a crash when core load gl resources.
1026   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1027   application.GetScene().Add( labelShort );
1028   // Turn on all the effects
1029   labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1030   labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1031   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1032   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1033   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1034   labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1035
1036   application.GetScene().Add( labelLong );
1037   // Turn on all the effects
1038   labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1039   labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1040   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1041   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1042   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1043   labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1044
1045   try
1046   {
1047     // Render some text with the shared atlas backend
1048     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1049     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1050     application.SendNotification();
1051     application.Render();
1052
1053     labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1054     labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1055     application.SendNotification();
1056     application.Render();
1057
1058   }
1059   catch( ... )
1060   {
1061     tet_result(TET_FAIL);
1062   }
1063
1064   END_TEST;
1065 }
1066
1067 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1068 {
1069   ToolkitTestApplication application;
1070   tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1071   TextLabel label = TextLabel::New("Some text to scroll");
1072   DALI_TEST_CHECK( label );
1073   // Avoid a crash when core load gl resources.
1074   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1075   application.GetScene().Add( label );
1076   label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 20.f ) );
1077   // Turn on all the effects
1078   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1079   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1080   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1081   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1082
1083   // Render the text.
1084   application.SendNotification();
1085   application.Render();
1086
1087   unsigned int actorCount1 = label.GetChildCount();
1088   tet_printf("Initial actor count is(%d)\n", actorCount1 );
1089
1090   try
1091   {
1092     // Render some text with the shared atlas backend
1093     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1094     application.SendNotification();
1095     application.Render(2000);
1096
1097     unsigned int actorCount1 = label.GetChildCount();
1098     tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1099
1100     label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1101
1102     // Render the text.
1103     application.SendNotification();
1104     application.Render();
1105
1106     unsigned int actorCount2 = label.GetChildCount();
1107     tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1108
1109     DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1110
1111   }
1112   catch( ... )
1113   {
1114     tet_result(TET_FAIL);
1115   }
1116
1117   END_TEST;
1118 }
1119
1120 int UtcDaliToolkitTextlabelScrollingN(void)
1121 {
1122   ToolkitTestApplication application;
1123   tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1124
1125   TextLabel label = TextLabel::New("Some text to scroll");
1126   DALI_TEST_CHECK( label );
1127
1128   application.GetScene().Add( label );
1129
1130   // Avoid a crash when core load gl resources.
1131   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1132
1133   // The text scrolling works only on single line text.
1134   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1135
1136   // Turn on all the effects.
1137   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1138   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1139   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1140
1141   // Enable the auto scrolling effect.
1142   label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1143
1144   // The auto scrolling shouldn't be enabled.
1145   const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1146   DALI_TEST_CHECK( !enabled );
1147
1148   END_TEST;
1149 }
1150
1151 int UtcDaliToolkitTextlabelScrollingWithEllipsis(void)
1152 {
1153   ToolkitTestApplication application;
1154   tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis");
1155
1156   TextLabel label = TextLabel::New("Some text to scroll");
1157   DALI_TEST_CHECK( label );
1158
1159   application.GetScene().Add( label );
1160
1161   // Avoid a crash when core load gl resources.
1162   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1163
1164   // Turn on all the effects.
1165   label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1166   label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1167   label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1168
1169   try
1170   {
1171     // Enable the auto scrolling effect.
1172     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1173     label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1174
1175     // Disable the ellipsis
1176     label.SetProperty( TextLabel::Property::ELLIPSIS, false );
1177
1178     // Render the text.
1179     application.SendNotification();
1180     application.Render();
1181
1182     // Stop auto scrolling
1183     label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1184
1185     // Check the ellipsis property
1186     DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
1187   }
1188   catch( ... )
1189   {
1190     tet_result(TET_FAIL);
1191   }
1192
1193   END_TEST;
1194 }
1195
1196 int UtcDaliToolkitTextlabelEllipsis(void)
1197 {
1198   ToolkitTestApplication application;
1199   tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1200
1201   TextLabel label = TextLabel::New("Hello world");
1202   DALI_TEST_CHECK( label );
1203
1204   // Avoid a crash when core load gl resources.
1205   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1206
1207   application.GetScene().Add( label );
1208
1209   // Turn on all the effects
1210   label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1211   label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1212   label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 10.f ) );
1213
1214   try
1215   {
1216     // Render the text.
1217     application.SendNotification();
1218     application.Render();
1219   }
1220   catch( ... )
1221   {
1222     tet_result(TET_FAIL);
1223   }
1224
1225   label.SetProperty( TextLabel::Property::TEXT, "Hello world                                        " );
1226   label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1227   label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1228
1229   try
1230   {
1231     // Render the text.
1232     application.SendNotification();
1233     application.Render();
1234   }
1235   catch( ... )
1236   {
1237     tet_result(TET_FAIL);
1238   }
1239
1240
1241   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1242   label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1243   label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1244
1245   try
1246   {
1247     // Render the text.
1248     application.SendNotification();
1249     application.Render();
1250   }
1251   catch( ... )
1252   {
1253     tet_result(TET_FAIL);
1254   }
1255
1256   END_TEST;
1257 }
1258
1259 int UtcDaliToolkitTextlabelTextWrapMode(void)
1260 {
1261   ToolkitTestApplication application;
1262   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1263
1264   int lineCount =0 ;
1265
1266   TextLabel label = TextLabel::New();
1267   label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1268   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1269   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1270
1271
1272
1273   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1274   application.GetScene().Add( label );
1275
1276   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1277   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1278
1279   application.SendNotification();
1280   application.Render();
1281
1282   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1283   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1284
1285   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1286   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1287
1288   application.SendNotification();
1289   application.Render();
1290
1291   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1292   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1293
1294   application.SendNotification();
1295   application.Render();
1296
1297   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1298   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1299
1300   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1301   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1302
1303   application.SendNotification();
1304   application.Render();
1305
1306   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1307   DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1308
1309   tet_infoline( "Ensure invalid string does not change wrapping mode" );
1310   label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1311   DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1312
1313   END_TEST;
1314 }
1315
1316 int UtcDaliToolkitTextLabelColorComponents(void)
1317 {
1318   ToolkitTestApplication application;
1319
1320   TextLabel label = TextLabel::New();
1321   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1322   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   1.0f, TEST_LOCATION );
1323   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1324   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1325   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1326
1327   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1328   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1329   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1330   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  0.0f, TEST_LOCATION );
1331   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1332
1333   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1334   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ),   0.0f, TEST_LOCATION );
1335   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1336   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ),  1.0f, TEST_LOCATION );
1337   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1338
1339   label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1340   DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1341   DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1342
1343   // Test a transparent text - Rendering should be skipped.
1344   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1345   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1346
1347   application.GetScene().Add( label );
1348
1349   TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1350   drawTrace.Enable( true );
1351
1352   application.SendNotification();
1353   application.Render();
1354
1355   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION );  // Should be rendered
1356
1357   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1358
1359   drawTrace.Reset();
1360
1361   application.SendNotification();
1362   application.Render();
1363
1364   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1365
1366   label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1367
1368   drawTrace.Reset();
1369
1370   application.SendNotification();
1371   application.Render();
1372
1373   DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1374
1375   END_TEST;
1376 }
1377
1378 int UtcDaliToolkitTextlabelTextStyle01(void)
1379 {
1380   ToolkitTestApplication application;
1381   tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1382
1383   TextLabel label = TextLabel::New();
1384   label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1385   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1386   label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1387   application.GetScene().Add( label );
1388
1389   Property::Map outlineMapSet;
1390   Property::Map outlineMapGet;
1391
1392   outlineMapSet["color"] = Color::BLUE;
1393   outlineMapSet["width"] = 2.0f;
1394   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1395
1396   application.SendNotification();
1397   application.Render();
1398
1399   Property::Map shadowMapSet;
1400   shadowMapSet.Insert( "color", "green" );
1401   shadowMapSet.Insert( "offset", "2 2" );
1402   shadowMapSet.Insert( "blurRadius", "3" );
1403   label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1404
1405   outlineMapSet["color"] = Color::RED;
1406   outlineMapSet["width"] = 0.0f;
1407   label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1408
1409   application.SendNotification();
1410   application.Render();
1411
1412   outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1413
1414   Property::Value* colorValue = outlineMapGet.Find("color");
1415
1416   bool colorMatched( false );
1417
1418   if ( colorValue )
1419   {
1420      Property::Type valueType = colorValue->GetType();
1421
1422      if ( Property::STRING == valueType )
1423      {
1424        std::string stringValue;
1425        colorValue->Get( stringValue );
1426        if (  stringValue == "red" )
1427        {
1428          colorMatched = true;
1429        }
1430      }
1431      else if ( Property::VECTOR4 == valueType )
1432      {
1433        Vector4 colorVector4;
1434        colorValue->Get( colorVector4 );
1435        if (  colorVector4 == Color::RED )
1436        {
1437          colorMatched = true;
1438        }
1439      }
1440   }
1441
1442   DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1443
1444   END_TEST;
1445 }
1446
1447 int UtcDaliToolkitTextlabelMultiline(void)
1448 {
1449   ToolkitTestApplication application;
1450   tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1451
1452   TextLabel label = TextLabel::New();
1453   label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1454   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1455   label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1456   application.GetScene().Add( label );
1457
1458   application.SendNotification();
1459   application.Render();
1460
1461   int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1462   DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1463
1464   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1465
1466   application.SendNotification();
1467   application.Render();
1468
1469   lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1470   DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1471
1472
1473   END_TEST;
1474 }
1475
1476 int UtcDaliToolkitTextlabelTextDirection(void)
1477 {
1478   ToolkitTestApplication application;
1479   tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1480
1481   TextLabel label = TextLabel::New();
1482   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1483
1484   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1485   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1486   application.GetScene().Add( label );
1487
1488   // Test LTR text
1489   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1490
1491   // Test RTL text
1492   label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1493   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1494
1495   // Test RTL text starting with weak character
1496   label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1497   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1498
1499   // Test RTL text string with emoji and weak character
1500   label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1501   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1502
1503   END_TEST;
1504 }
1505
1506 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1507 {
1508   ToolkitTestApplication application;
1509   tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1510
1511   TextLabel label = TextLabel::New();
1512
1513   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP  );
1514   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1515   label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1516   label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1517   application.GetScene().Add( label );
1518   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1519
1520   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE  );
1521   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1522
1523   label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM  );
1524   DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1525
1526   END_TEST;
1527 }
1528
1529 int UtcDaliToolkitTextLabelBitmapFont(void)
1530 {
1531   ToolkitTestApplication application;
1532   tet_infoline(" UtcDaliToolkitTextLabelBitmapFont");
1533
1534   DevelText::BitmapFontDescription fontDescription;
1535   fontDescription.name = "Digits";
1536   fontDescription.underlinePosition = 0.f;
1537   fontDescription.underlineThickness = 0.f;
1538
1539   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 34.f, 0.f } );
1540   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f } );
1541   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f } );
1542   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0033.png", "2", 34.f, 0.f } );
1543   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0034.png", "3", 34.f, 0.f } );
1544   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0035.png", "4", 34.f, 0.f } );
1545   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0036.png", "5", 34.f, 0.f } );
1546   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0037.png", "6", 34.f, 0.f } );
1547   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0038.png", "7", 34.f, 0.f } );
1548   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0039.png", "8", 34.f, 0.f } );
1549   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u003a.png", "9", 34.f, 0.f } );
1550
1551   TextAbstraction::BitmapFont bitmapFont;
1552   DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1553
1554   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1555   fontClient.GetFontId( bitmapFont );
1556
1557   TextLabel label = TextLabel::New();
1558
1559   label.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
1560   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1561
1562   // The text has been laid out with the bitmap font if the natural size is the sum of all the width (322) and 34 height.
1563   DALI_TEST_EQUALS( label.GetNaturalSize(), Vector3(322.f, 34.f, 0.f), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1564
1565   application.GetScene().Add( label );
1566
1567   application.SendNotification();
1568   application.Render();
1569
1570   // The text has been rendered if the height of the text-label is the height of the line.
1571   DALI_TEST_EQUALS( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1572
1573   END_TEST;
1574 }
1575
1576 int ConvertPointToPixel( float point )
1577 {
1578   unsigned int horizontalDpi = 0u;
1579   unsigned int verticalDpi = 0u;
1580   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1581   fontClient.GetDpi( horizontalDpi, verticalDpi );
1582
1583   return ( point * 72.f ) / static_cast< float >( horizontalDpi );
1584 }
1585
1586 int UtcDaliToolkitTextlabelTextFit(void)
1587 {
1588   ToolkitTestApplication application;
1589   tet_infoline(" UtcDaliToolkitTextlabelTextFit");
1590   TextLabel label = TextLabel::New();
1591   Vector2 size( 460.0f, 100.0f );
1592   label.SetProperty( Actor::Property::SIZE, size );
1593   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1594
1595   // check point size
1596   Property::Map textFitMapSet;
1597   textFitMapSet["enable"] = true;
1598   textFitMapSet["minSize"] = 10.f;
1599   textFitMapSet["maxSize"] = 100.f;
1600   textFitMapSet["stepSize"] = -1.f;
1601   textFitMapSet["fontSizeType"] = "pointSize";
1602
1603   label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1604   label.SetProperty( TextLabel::Property::POINT_SIZE, 120.f);
1605
1606   application.GetScene().Add( label );
1607
1608   application.SendNotification();
1609   application.Render();
1610
1611   const Vector3 EXPECTED_NATURAL_SIZE( 452.0f, 94.0f, 0.0f );
1612   DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1613
1614   // check pixel size
1615   textFitMapSet.Clear();
1616   textFitMapSet["enable"] = true;
1617   textFitMapSet["minSize"] = ConvertPointToPixel( 10.f );
1618   textFitMapSet["maxSize"] = ConvertPointToPixel( 100.f );
1619   textFitMapSet["stepSize"] = ConvertPointToPixel ( 1.f );
1620   textFitMapSet["fontSizeType"] = "pixelSize";
1621
1622   label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1623
1624   application.SendNotification();
1625   application.Render();
1626
1627   DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1628
1629   END_TEST;
1630 }
1631
1632 int UtcDaliToolkitTextlabelMaxTextureSet(void)
1633 {
1634   ToolkitTestApplication application;
1635   tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
1636
1637   DevelText::BitmapFontDescription fontDescription;
1638   fontDescription.name = "Digits";
1639   fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } );
1640
1641   TextAbstraction::BitmapFont bitmapFont;
1642   DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1643
1644   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1645   fontClient.GetFontId( bitmapFont );
1646
1647   TextLabel label = TextLabel::New();
1648   label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1649   label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
1650   label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." );
1651   label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f );
1652   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1653
1654   Property::Map underlineMapSet;
1655   underlineMapSet.Clear();
1656   underlineMapSet.Insert( "enable", true );
1657   underlineMapSet.Insert( "color", Color::RED );
1658   underlineMapSet.Insert( "height", 1 );
1659   label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
1660   label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1661
1662   application.GetScene().Add( label );
1663
1664   application.SendNotification();
1665   application.Render();
1666
1667   const int maxTextureSize = Dali::GetMaxTextureSize();
1668   // Whether the rendered text is greater than maxTextureSize
1669   DALI_TEST_CHECK( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height > maxTextureSize );
1670
1671   // Check if the number of renderers is greater than 1.
1672   DALI_TEST_CHECK( label.GetRendererCount() > 1u );
1673
1674   END_TEST;
1675 }
1676
1677 int UtcDaliToolkitTextlabelLastCharacterIndex(void)
1678 {
1679   ToolkitTestApplication application;
1680   tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
1681
1682   Vector2 size( 300.0f, 100.0f );
1683
1684   Dali::Toolkit::DevelText::RendererParameters textParameters;
1685   textParameters.text = "This is a sample text to get the last index.";
1686   textParameters.layout = "multiLine";
1687   textParameters.fontSize = 20.f;
1688   textParameters.textWidth = 300u;
1689   textParameters.textHeight = 100u;
1690   textParameters.ellipsisEnabled = true;
1691   Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex( textParameters );
1692
1693   DALI_TEST_CHECK( !indexArray.Empty() );
1694   DALI_TEST_EQUALS( indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION );
1695
1696   END_TEST;
1697 }
1698
1699 int UtcDaliToolkitTextlabelFontSizeScale(void)
1700 {
1701   ToolkitTestApplication application;
1702   tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
1703
1704   TextLabel label = TextLabel::New();
1705   label.SetProperty( TextLabel::Property::POINT_SIZE, 30.f );
1706   label.SetProperty( TextLabel::Property::TEXT, "Test" );
1707   Vector3 nonScaledSize = label.GetNaturalSize();
1708
1709   TextLabel labelScaled = TextLabel::New();
1710   labelScaled.SetProperty( TextLabel::Property::POINT_SIZE, 15.f );
1711   labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1712   labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1713   Vector3 scaledSize = labelScaled.GetNaturalSize();
1714
1715   DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1716
1717   label.SetProperty( TextLabel::Property::PIXEL_SIZE, 30.f );
1718   label.SetProperty( TextLabel::Property::TEXT, "Test" );
1719   nonScaledSize = label.GetNaturalSize();
1720
1721   labelScaled.SetProperty( TextLabel::Property::PIXEL_SIZE, 15.f );
1722   labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1723   labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1724   scaledSize = labelScaled.GetNaturalSize();
1725
1726   DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1727
1728   END_TEST;
1729 }