Adding Character Spacing
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextLabel.cpp
1 /*
2  * Copyright (c) 2022 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 <stdlib.h>
19 #include <unistd.h>
20 #include <iostream>
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/bitmap-font.h>
27 #include <dali-toolkit/devel-api/text/rendering-backend.h>
28 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
29 #include <dali-toolkit/devel-api/text/text-utils-devel.h>
30 #include <dali/devel-api/adaptor-framework/image-loading.h>
31 #include <dali/devel-api/text-abstraction/bitmap-font.h>
32 #include <dali/devel-api/text-abstraction/font-client.h>
33 #include "test-text-geometry-utils.h"
34
35 using namespace Dali;
36 using namespace Toolkit;
37
38 void dali_textlabel_startup(void)
39 {
40   test_return_value = TET_UNDEF;
41 }
42
43 void dali_textlabel_cleanup(void)
44 {
45   test_return_value = TET_PASS;
46 }
47
48 namespace
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 const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
72
73 const char* const PROPERTY_NAME_PIXEL_SIZE             = "pixelSize";
74 const char* const PROPERTY_NAME_ELLIPSIS               = "ellipsis";
75 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
76 const char* const PROPERTY_NAME_FONT_SIZE_SCALE        = "fontSizeScale";
77 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
78
79 const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
80
81 const std::string  DEFAULT_FONT_DIR("/resources/fonts");
82 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
83
84 static bool gAnchorClickedCallBackCalled;
85 static bool gAnchorClickedCallBackNotCalled;
86
87 static bool gTextFitChangedCallBackCalled;
88
89 struct CallbackFunctor
90 {
91   CallbackFunctor(bool* callbackFlag)
92   : mCallbackFlag(callbackFlag)
93   {
94   }
95
96   void operator()()
97   {
98     *mCallbackFlag = true;
99   }
100   bool* mCallbackFlag;
101 };
102
103 static void TestAnchorClickedCallback(TextLabel control, const char* href, unsigned int hrefLength)
104 {
105   tet_infoline(" TestAnchorClickedCallback");
106
107   gAnchorClickedCallBackNotCalled = false;
108
109   if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
110   {
111     gAnchorClickedCallBackCalled = true;
112   }
113 }
114
115 static void TestTextFitChangedCallback(TextLabel control)
116 {
117   tet_infoline(" TestTextFitChangedCallback");
118   gTextFitChangedCallBackCalled = true;
119 }
120
121 bool DaliTestCheckMaps(const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>())
122 {
123   const Property::Map::SizeType size = mapGet.Count();
124
125   if(size == mapSet.Count())
126   {
127     for(unsigned int index = 0u; index < size; ++index)
128     {
129       const KeyValuePair& valueGet = mapGet.GetKeyValue(index);
130
131       // Find the keys of the 'get' map
132       Property::Index indexKey  = valueGet.first.indexKey;
133       std::string     stringKey = valueGet.first.stringKey;
134
135       if(!indexConversionTable.empty())
136       {
137         if(stringKey.empty())
138         {
139           stringKey = indexConversionTable[indexKey];
140         }
141
142         if((indexKey == Property::INVALID_INDEX) && !stringKey.empty())
143         {
144           Property::Index index = 0u;
145           for(auto key : indexConversionTable)
146           {
147             if(key == stringKey)
148             {
149               indexKey = index;
150               break;
151             }
152             ++index;
153           }
154         }
155       }
156
157       const Property::Value* const valueSet = mapSet.Find(indexKey, stringKey);
158
159       if(nullptr != valueSet)
160       {
161         if((valueSet->GetType() == Dali::Property::STRING) && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
162         {
163           tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
164           return false;
165         }
166         else if((valueSet->GetType() == Dali::Property::BOOLEAN) && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
167         {
168           tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
169           return false;
170         }
171         else if((valueSet->GetType() == Dali::Property::INTEGER) && (valueGet.second.Get<int>() != valueSet->Get<int>()))
172         {
173           tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
174           return false;
175         }
176         else if((valueSet->GetType() == Dali::Property::FLOAT) && (valueGet.second.Get<float>() != valueSet->Get<float>()))
177         {
178           tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
179           return false;
180         }
181         else if((valueSet->GetType() == Dali::Property::VECTOR2) && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
182         {
183           Vector2 vector2Get = valueGet.second.Get<Vector2>();
184           Vector2 vector2Set = valueSet->Get<Vector2>();
185           tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
186           return false;
187         }
188         else if((valueSet->GetType() == Dali::Property::VECTOR4) && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
189         {
190           Vector4 vector4Get = valueGet.second.Get<Vector4>();
191           Vector4 vector4Set = valueSet->Get<Vector4>();
192           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);
193           return false;
194         }
195       }
196       else
197       {
198         if(valueGet.first.type == Property::Key::INDEX)
199         {
200           tet_printf("  The key %d doesn't exist.", valueGet.first.indexKey);
201         }
202         else
203         {
204           tet_printf("  The key %s doesn't exist.", valueGet.first.stringKey.c_str());
205         }
206         return false;
207       }
208     }
209   }
210
211   return true;
212 }
213
214 } // namespace
215
216 int UtcDaliToolkitTextLabelConstructorP(void)
217 {
218   ToolkitTestApplication application;
219   tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
220   TextLabel textLabel;
221   DALI_TEST_CHECK(!textLabel);
222   END_TEST;
223 }
224
225 int UtcDaliToolkitTextLabelNewP(void)
226 {
227   ToolkitTestApplication application;
228   tet_infoline(" UtcDaliToolkitTextLabelNewP");
229   TextLabel textLabel = TextLabel::New("Test Text");
230   DALI_TEST_CHECK(textLabel);
231   END_TEST;
232 }
233
234 int UtcDaliToolkitTextLabelDownCastP(void)
235 {
236   ToolkitTestApplication application;
237   tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
238   TextLabel  textLabel1 = TextLabel::New();
239   BaseHandle object(textLabel1);
240
241   TextLabel textLabel2 = TextLabel::DownCast(object);
242   DALI_TEST_CHECK(textLabel2);
243
244   TextLabel textLabel3 = DownCast<TextLabel>(object);
245   DALI_TEST_CHECK(textLabel3);
246   END_TEST;
247 }
248
249 int UtcDaliToolkitTextLabelDownCastN(void)
250 {
251   ToolkitTestApplication application;
252   tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
253   BaseHandle uninitializedObject;
254   TextLabel  textLabel1 = TextLabel::DownCast(uninitializedObject);
255   DALI_TEST_CHECK(!textLabel1);
256
257   TextLabel textLabel2 = DownCast<TextLabel>(uninitializedObject);
258   DALI_TEST_CHECK(!textLabel2);
259   END_TEST;
260 }
261
262 int UtcDaliToolkitTextLabelCopyConstructorP(void)
263 {
264   ToolkitTestApplication application;
265   tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
266   TextLabel textLabel = TextLabel::New();
267   textLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED);
268
269   TextLabel copy(textLabel);
270   DALI_TEST_CHECK(copy);
271   DALI_TEST_CHECK(copy.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR) == textLabel.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR));
272   END_TEST;
273 }
274
275 int UtcDaliTextLabelMoveConstructor(void)
276 {
277   ToolkitTestApplication application;
278
279   TextLabel textLabel = TextLabel::New();
280   textLabel.SetProperty(TextLabel::Property::TEXT, "Test");
281   DALI_TEST_CHECK(textLabel.GetProperty<std::string>(TextLabel::Property::TEXT) == "Test");
282
283   TextLabel moved = std::move(textLabel);
284   DALI_TEST_CHECK(moved);
285   DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
286   DALI_TEST_CHECK(moved.GetProperty<std::string>(TextLabel::Property::TEXT) == "Test");
287   DALI_TEST_CHECK(!textLabel);
288
289   END_TEST;
290 }
291
292 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
293 {
294   ToolkitTestApplication application;
295   tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
296   TextLabel textLabel = TextLabel::New();
297   textLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED);
298
299   TextLabel copy = textLabel;
300   DALI_TEST_CHECK(copy);
301   DALI_TEST_CHECK(copy.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR) == textLabel.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR));
302   END_TEST;
303 }
304
305 int UtcDaliTextLabelMoveAssignment(void)
306 {
307   ToolkitTestApplication application;
308
309   TextLabel textLabel = TextLabel::New();
310   textLabel.SetProperty(TextLabel::Property::TEXT, "Test");
311   DALI_TEST_CHECK(textLabel.GetProperty<std::string>(TextLabel::Property::TEXT) == "Test");
312
313   TextLabel moved;
314   moved = std::move(textLabel);
315   DALI_TEST_CHECK(moved);
316   DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
317   DALI_TEST_CHECK(moved.GetProperty<std::string>(TextLabel::Property::TEXT) == "Test");
318   DALI_TEST_CHECK(!textLabel);
319
320   END_TEST;
321 }
322
323 // Positive test case for a method
324 int UtcDaliToolkitTextLabelGetPropertyP(void)
325 {
326   ToolkitTestApplication application;
327   tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
328   TextLabel label = TextLabel::New("Test Text");
329   DALI_TEST_CHECK(label);
330
331   // Check Property Indices are correct
332   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextLabel::Property::RENDERING_BACKEND);
333   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextLabel::Property::TEXT);
334   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextLabel::Property::FONT_FAMILY);
335   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextLabel::Property::FONT_STYLE);
336   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextLabel::Property::POINT_SIZE);
337   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_MULTI_LINE) == TextLabel::Property::MULTI_LINE);
338   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextLabel::Property::HORIZONTAL_ALIGNMENT);
339   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_VERTICAL_ALIGNMENT) == TextLabel::Property::VERTICAL_ALIGNMENT);
340   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextLabel::Property::TEXT_COLOR);
341   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP);
342   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_AUTO_SCROLL) == TextLabel::Property::ENABLE_AUTO_SCROLL);
343   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED) == TextLabel::Property::AUTO_SCROLL_SPEED);
344   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT);
345   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP) == TextLabel::Property::AUTO_SCROLL_GAP);
346   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextLabel::Property::LINE_SPACING);
347   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextLabel::Property::UNDERLINE);
348   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextLabel::Property::SHADOW);
349   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextLabel::Property::EMBOSS);
350   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextLabel::Property::OUTLINE);
351   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_BACKGROUND) == DevelTextLabel::Property::BACKGROUND);
352   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextLabel::Property::PIXEL_SIZE);
353   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ELLIPSIS) == TextLabel::Property::ELLIPSIS);
354   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY);
355   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextLabel::Property::FONT_SIZE_SCALE);
356   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE);
357   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ELLIPSIS_POSITION) == DevelTextLabel::Property::ELLIPSIS_POSITION);
358   DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextLabel::Property::STRIKETHROUGH);
359
360   END_TEST;
361 }
362
363 int UtcDaliToolkitTextLabelSetPropertyP(void)
364 {
365   ToolkitTestApplication application;
366   tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
367   TextLabel label = TextLabel::New();
368   DALI_TEST_CHECK(label);
369
370   application.GetScene().Add(label);
371
372   // Note - we can't check the defaults since the stylesheets are platform-specific
373   label.SetProperty(DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
374   DALI_TEST_EQUALS((DevelText::RenderingType)label.GetProperty<int>(DevelTextLabel::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
375
376   // Check that text can be correctly reset
377   label.SetProperty(TextLabel::Property::TEXT, "Setting Text");
378   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
379
380   // Check font properties.
381   label.SetProperty(TextLabel::Property::FONT_FAMILY, "Setting font family");
382   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
383
384   Property::Map fontStyleMapSet;
385   Property::Map fontStyleMapGet;
386
387   fontStyleMapSet.Insert("weight", "bold");
388   fontStyleMapSet.Insert("width", "condensed");
389   fontStyleMapSet.Insert("slant", "italic");
390   label.SetProperty(TextLabel::Property::FONT_STYLE, fontStyleMapSet);
391
392   fontStyleMapGet = label.GetProperty<Property::Map>(TextLabel::Property::FONT_STYLE);
393   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
394   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
395
396   // Check the old font style format.
397   fontStyleMapSet.Clear();
398   fontStyleMapSet.Insert("weight", "thin");
399   fontStyleMapSet.Insert("width", "expanded");
400   fontStyleMapSet.Insert("slant", "oblique");
401   const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
402
403   label.SetProperty(TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}");
404   std::string getFontStyle = label.GetProperty<std::string>(TextLabel::Property::FONT_STYLE);
405   DALI_TEST_EQUALS(getFontStyle, strFontStyle, TEST_LOCATION);
406
407   label.SetProperty(TextLabel::Property::POINT_SIZE, 10.f);
408   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
409
410   label.SetProperty(DevelTextLabel::Property::FONT_SIZE_SCALE, 2.5f);
411   DALI_TEST_EQUALS(label.GetProperty<float>(DevelTextLabel::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
412   label.SetProperty(DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f);
413
414   label.SetProperty(DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false);
415   DALI_TEST_EQUALS(label.GetProperty<bool>(DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
416   label.SetProperty(DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true);
417
418   // Reset font style.
419   fontStyleMapSet.Clear();
420   fontStyleMapSet.Insert("weight", "normal");
421   fontStyleMapSet.Insert("slant", "oblique");
422
423   label.SetProperty(TextLabel::Property::FONT_STYLE, fontStyleMapSet);
424   fontStyleMapGet = label.GetProperty<Property::Map>(TextLabel::Property::FONT_STYLE);
425   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
426   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
427
428   fontStyleMapSet.Clear();
429   fontStyleMapSet.Insert("slant", "roman");
430
431   label.SetProperty(TextLabel::Property::FONT_STYLE, fontStyleMapSet);
432   fontStyleMapGet = label.GetProperty<Property::Map>(TextLabel::Property::FONT_STYLE);
433   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
434
435   // Replace 'roman' for 'normal'.
436   Property::Value* slantValue = fontStyleMapGet.Find("slant");
437   if(NULL != slantValue)
438   {
439     if("normal" == slantValue->Get<std::string>())
440     {
441       fontStyleMapGet["slant"] = "roman";
442     }
443   }
444   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
445
446   fontStyleMapSet.Clear();
447
448   label.SetProperty(TextLabel::Property::FONT_STYLE, fontStyleMapSet);
449   fontStyleMapGet = label.GetProperty<Property::Map>(TextLabel::Property::FONT_STYLE);
450   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
451   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
452
453   // Toggle multi-line
454   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
455   DALI_TEST_EQUALS(label.GetProperty<bool>(TextLabel::Property::MULTI_LINE), true, TEST_LOCATION);
456
457   // Check that the Alignment properties can be correctly set
458   label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
459   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::HORIZONTAL_ALIGNMENT), "CENTER", TEST_LOCATION);
460   label.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
461   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::VERTICAL_ALIGNMENT), "CENTER", TEST_LOCATION);
462
463   // Check that text color can be properly set
464   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::BLUE);
465   DALI_TEST_EQUALS(label.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR), Color::BLUE, TEST_LOCATION);
466
467   Property::Map strikethroughMapSet;
468   Property::Map strikethroughMapGet;
469
470   strikethroughMapSet.Insert("enable", false);
471   strikethroughMapSet.Insert("color", Color::BLUE);
472   strikethroughMapSet.Insert("height", 2.0f);
473
474   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
475
476   strikethroughMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
477   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
478   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
479
480   Property::Map underlineMapSet;
481   Property::Map underlineMapGet;
482
483   underlineMapSet.Insert("enable", false);
484   underlineMapSet.Insert("color", Color::BLUE);
485   underlineMapSet.Insert("height", 0);
486   underlineMapSet.Insert("type", Text::Underline::SOLID);
487   underlineMapSet.Insert("dashWidth", 2);
488   underlineMapSet.Insert("dashGap", 1);
489
490   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
491
492   application.SendNotification();
493   application.Render();
494
495   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
496   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
497   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
498
499   //DASHED Underline
500   underlineMapSet.Clear();
501   underlineMapGet.Clear();
502
503   underlineMapSet.Insert("enable", false);
504   underlineMapSet.Insert("color", Color::BLUE);
505   underlineMapSet.Insert("height", 0);
506   underlineMapSet.Insert("type", Text::Underline::DASHED);
507   underlineMapSet.Insert("dashWidth", 2);
508   underlineMapSet.Insert("dashGap", 1);
509
510   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
511
512   application.SendNotification();
513   application.Render();
514
515   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
516   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
517   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
518
519   //DOUBLE Underline
520   underlineMapSet.Clear();
521   underlineMapGet.Clear();
522
523   underlineMapSet.Insert("enable", false);
524   underlineMapSet.Insert("color", Color::BLUE);
525   underlineMapSet.Insert("height", 0);
526   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
527   underlineMapSet.Insert("dashWidth", 2);
528   underlineMapSet.Insert("dashGap", 1);
529
530   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
531
532   application.SendNotification();
533   application.Render();
534
535   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
536   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
537   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
538
539   TextLabel label2 = TextLabel::New("New text");
540   DALI_TEST_CHECK(label2);
541   DALI_TEST_EQUALS(label2.GetProperty<std::string>(TextLabel::Property::TEXT), std::string("New text"), TEST_LOCATION);
542
543   // Check the enable markup property.
544   DALI_TEST_CHECK(!label.GetProperty<bool>(TextLabel::Property::ENABLE_MARKUP));
545   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
546   DALI_TEST_CHECK(label.GetProperty<bool>(TextLabel::Property::ENABLE_MARKUP));
547
548   // Check the text property when markup is enabled
549   label.SetProperty(TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>");
550   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::TEXT), std::string("MarkupText"), TEST_LOCATION);
551
552   // Check for incomplete marks.
553   label.SetProperty(TextLabel::Property::TEXT, "<color='white'><i>Markup</i><b>Text</b></color>");
554   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::TEXT), std::string("MarkupText"), TEST_LOCATION);
555   try
556   {
557     application.SendNotification();
558     application.Render();
559   }
560   catch(...)
561   {
562     tet_result(TET_FAIL);
563   }
564
565   // Check autoscroll properties
566   const int         SCROLL_SPEED      = 80;
567   const int         SCROLL_LOOPS      = 4;
568   const float       SCROLL_GAP        = 50.0f;
569   const float       SCROLL_LOOP_DELAY = 0.3f;
570   const std::string STOP_IMMEDIATE    = std::string("IMMEDIATE");
571   const std::string STOP_FINISH_LOOP  = std::string("FINISH_LOOP");
572
573   label.SetProperty(TextLabel::Property::MULTI_LINE, false); // Autoscroll only supported in single line
574   DALI_TEST_CHECK(!label.GetProperty<bool>(TextLabel::Property::ENABLE_AUTO_SCROLL));
575   label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
576   DALI_TEST_CHECK(label.GetProperty<bool>(TextLabel::Property::ENABLE_AUTO_SCROLL));
577   label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED);
578   DALI_TEST_EQUALS(SCROLL_SPEED, label.GetProperty<int>(TextLabel::Property::AUTO_SCROLL_SPEED), TEST_LOCATION);
579   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS);
580   DALI_TEST_EQUALS(SCROLL_LOOPS, label.GetProperty<int>(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT), TEST_LOCATION);
581   label.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP);
582   DALI_TEST_EQUALS(SCROLL_GAP, label.GetProperty<float>(TextLabel::Property::AUTO_SCROLL_GAP), TEST_LOCATION);
583   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY);
584   DALI_TEST_EQUALS(SCROLL_LOOP_DELAY, label.GetProperty<float>(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY), TEST_LOCATION);
585
586   //Check autoscroll stop type property
587   label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
588   DALI_TEST_EQUALS(STOP_IMMEDIATE, label.GetProperty<std::string>(TextLabel::Property::AUTO_SCROLL_STOP_MODE), TEST_LOCATION);
589
590   label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
591   DALI_TEST_EQUALS(STOP_FINISH_LOOP, label.GetProperty<std::string>(TextLabel::Property::AUTO_SCROLL_STOP_MODE), TEST_LOCATION);
592
593   // test natural size with multi-line and line spacing
594   {
595     TextLabel label3             = TextLabel::New("Some text here\nend there\nend here");
596     Vector3   oneLineNaturalSize = label3.GetNaturalSize();
597     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
598     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
599     Vector3 multiLineNaturalSize = label3.GetNaturalSize();
600
601     // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
602     // The height of the text when multi-line is enabled will be larger
603     DALI_TEST_CHECK(oneLineNaturalSize.width > multiLineNaturalSize.width);
604     DALI_TEST_CHECK(oneLineNaturalSize.height < multiLineNaturalSize.height);
605
606     // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
607     // Everything else will remain the same
608     int lineSpacing = 20;
609     label3.SetProperty(TextLabel::Property::LINE_SPACING, lineSpacing);
610     Vector3 expectedAfterLineSpacingApplied(multiLineNaturalSize);
611     expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
612     DALI_TEST_EQUALS(expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION);
613   }
614
615   // single line, line spacing must not affect natural size of the text, only add the spacing to the height
616   {
617     TextLabel label3 = TextLabel::New("Some text here end there end here");
618     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
619     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
620     Vector3 textNaturalSize = label3.GetNaturalSize();
621     int     lineSpacing     = 20;
622     label3.SetProperty(TextLabel::Property::LINE_SPACING, lineSpacing);
623     Vector3 expectedNaturalSizeWithLineSpacing(textNaturalSize);
624     expectedNaturalSizeWithLineSpacing.height += lineSpacing;
625     DALI_TEST_EQUALS(expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION);
626   }
627   // Check the line spacing property
628   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
629   label.SetProperty(TextLabel::Property::LINE_SPACING, 10.f);
630   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
631
632   // Check the strikethrough property
633   strikethroughMapSet.Clear();
634   strikethroughMapSet.Insert("enable", true);
635   strikethroughMapSet.Insert("color", Color::RED);
636   strikethroughMapSet.Insert("height", 2.0f);
637
638   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
639
640   application.SendNotification();
641   application.Render();
642
643   strikethroughMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
644   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
645   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
646
647   strikethroughMapSet.Clear();
648   strikethroughMapSet.Insert(Toolkit::DevelText::Strikethrough::Property::ENABLE, true);
649   strikethroughMapSet.Insert(Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED);
650   strikethroughMapSet.Insert(Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f);
651
652   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
653
654   application.SendNotification();
655   application.Render();
656
657   strikethroughMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
658   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
659   std::vector<std::string> strikethroughIndicesConversionTable = {"enable", "color", "height"};
660   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable), true, TEST_LOCATION);
661
662   strikethroughMapSet.Clear();
663
664   Property::Map strikethroughDisabledMapGet;
665   strikethroughDisabledMapGet.Insert("enable", false);
666   strikethroughDisabledMapGet.Insert("color", Color::RED);
667   strikethroughDisabledMapGet.Insert("height", 2.0f);
668
669   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
670
671   application.SendNotification();
672   application.Render();
673
674   strikethroughMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
675   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION);
676   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughDisabledMapGet), true, TEST_LOCATION);
677
678   // Check the underline property
679   underlineMapSet.Clear();
680   underlineMapSet.Insert("enable", true);
681   underlineMapSet.Insert("color", Color::RED);
682   underlineMapSet.Insert("height", 1);
683   underlineMapSet.Insert("type", Text::Underline::SOLID);
684   underlineMapSet.Insert("dashWidth", 2);
685   underlineMapSet.Insert("dashGap", 1);
686
687   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
688
689   application.SendNotification();
690   application.Render();
691
692   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
693   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
694   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
695
696   underlineMapSet.Clear();
697   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::ENABLE, true);
698   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN);
699   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::HEIGHT, 2);
700   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::TYPE, Text::Underline::DASHED);
701   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_WIDTH, 2);
702   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_GAP, 1);
703
704   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
705
706   application.SendNotification();
707   application.Render();
708
709   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
710   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
711   std::vector<std::string> underlineIndicesConversionTable = {"enable", "color", "height", "type", "dashWidth", "dashGap"};
712   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet, underlineIndicesConversionTable), true, TEST_LOCATION);
713
714   underlineMapSet.Clear();
715
716   Property::Map underlineDisabledMapGet;
717   underlineDisabledMapGet.Insert("enable", false);
718   underlineDisabledMapGet.Insert("color", Color::GREEN);
719   underlineDisabledMapGet.Insert("height", 2);
720   underlineDisabledMapGet.Insert("type", Text::Underline::SOLID);
721   underlineDisabledMapGet.Insert("dashWidth", 2);
722   underlineDisabledMapGet.Insert("dashGap", 1);
723
724   label.SetProperty(TextLabel::Property::UNDERLINE, underlineDisabledMapGet);
725
726   application.SendNotification();
727   application.Render();
728
729   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
730   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION);
731   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineDisabledMapGet), true, TEST_LOCATION);
732
733   // Check the dashed underline property
734   underlineMapSet.Clear();
735   underlineMapSet.Insert("enable", true);
736   underlineMapSet.Insert("color", Color::RED);
737   underlineMapSet.Insert("height", 1);
738   underlineMapSet.Insert("type", Text::Underline::DASHED);
739   underlineMapSet.Insert("dashWidth", 2);
740   underlineMapSet.Insert("dashGap", 1);
741
742   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
743
744   application.SendNotification();
745   application.Render();
746
747   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
748   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
749   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
750
751   underlineMapSet.Clear();
752   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::ENABLE, true);
753   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN);
754   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::HEIGHT, 2);
755   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::TYPE, Text::Underline::DASHED);
756   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_WIDTH, 2);
757   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_GAP, 1);
758
759   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
760
761   application.SendNotification();
762   application.Render();
763
764   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
765   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
766   underlineIndicesConversionTable = {"enable", "color", "height", "type", "dashWidth", "dashGap"};
767   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet, underlineIndicesConversionTable), true, TEST_LOCATION);
768
769   underlineMapSet.Clear();
770
771   underlineDisabledMapGet.Clear();
772   underlineDisabledMapGet.Insert("enable", false);
773   underlineDisabledMapGet.Insert("color", Color::GREEN);
774   underlineDisabledMapGet.Insert("height", 2);
775   underlineDisabledMapGet.Insert("type", Text::Underline::DASHED);
776   underlineDisabledMapGet.Insert("dashWidth", 2);
777   underlineDisabledMapGet.Insert("dashGap", 1);
778
779   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
780
781   application.SendNotification();
782   application.Render();
783
784   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
785   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION);
786   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineDisabledMapGet), true, TEST_LOCATION);
787
788   // Check the double underline property
789   underlineMapSet.Clear();
790   underlineMapSet.Insert("enable", true);
791   underlineMapSet.Insert("color", Color::RED);
792   underlineMapSet.Insert("height", 1);
793   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
794   underlineMapSet.Insert("dashWidth", 2);
795   underlineMapSet.Insert("dashGap", 1);
796
797   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
798
799   application.SendNotification();
800   application.Render();
801
802   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
803   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
804   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
805
806   underlineMapSet.Clear();
807   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::ENABLE, true);
808   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN);
809   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::HEIGHT, 2);
810   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::TYPE, Text::Underline::DOUBLE);
811   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_WIDTH, 2);
812   underlineMapSet.Insert(Toolkit::DevelText::Underline::Property::DASH_GAP, 1);
813
814   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
815
816   application.SendNotification();
817   application.Render();
818
819   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
820   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
821   underlineIndicesConversionTable = {"enable", "color", "height", "type", "dashWidth", "dashGap"};
822   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet, underlineIndicesConversionTable), true, TEST_LOCATION);
823
824   underlineMapSet.Clear();
825
826   underlineDisabledMapGet.Clear();
827   underlineDisabledMapGet.Insert("enable", false);
828   underlineDisabledMapGet.Insert("color", Color::GREEN);
829   underlineDisabledMapGet.Insert("height", 2);
830   underlineDisabledMapGet.Insert("type", Text::Underline::DOUBLE);
831   underlineDisabledMapGet.Insert("dashWidth", 2);
832   underlineDisabledMapGet.Insert("dashGap", 1);
833
834   label.SetProperty(TextLabel::Property::UNDERLINE, underlineDisabledMapGet);
835
836   application.SendNotification();
837   application.Render();
838
839   underlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::UNDERLINE);
840   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION);
841   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineDisabledMapGet), true, TEST_LOCATION);
842
843   // Check the shadow property
844
845   Property::Map shadowMapSet;
846   Property::Map shadowMapGet;
847
848   shadowMapSet.Insert("color", Color::GREEN);
849   shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
850   shadowMapSet.Insert("blurRadius", 5.0f);
851
852   label.SetProperty(TextLabel::Property::SHADOW, shadowMapSet);
853
854   shadowMapGet = label.GetProperty<Property::Map>(TextLabel::Property::SHADOW);
855   DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
856   DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
857
858   shadowMapSet.Clear();
859
860   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE);
861   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0");
862   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f);
863
864   label.SetProperty(TextLabel::Property::SHADOW, shadowMapSet);
865
866   // Replace the offset (string) by a vector2
867   shadowMapSet.Clear();
868   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE);
869   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::OFFSET, Vector2(3.0, 3.0));
870   shadowMapSet.Insert(Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f);
871
872   shadowMapGet = label.GetProperty<Property::Map>(TextLabel::Property::SHADOW);
873   DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
874   std::vector<std::string> shadowIndicesConversionTable = {"color", "offset", "blurRadius"};
875   DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet, shadowIndicesConversionTable), true, TEST_LOCATION);
876
877   shadowMapSet.Clear();
878   Property::Map shadowDisabledMapGet;
879   shadowDisabledMapGet.Insert("color", Color::BLUE);
880   shadowDisabledMapGet.Insert("offset", Vector2(0.0f, 0.0f));
881   shadowDisabledMapGet.Insert("blurRadius", 3.0f);
882
883   label.SetProperty(TextLabel::Property::SHADOW, shadowMapSet);
884
885   shadowMapGet = label.GetProperty<Property::Map>(TextLabel::Property::SHADOW);
886   DALI_TEST_EQUALS(shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION);
887   DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowDisabledMapGet), true, TEST_LOCATION);
888
889   // Check the emboss property
890   label.SetProperty(TextLabel::Property::EMBOSS, "Emboss properties");
891   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
892
893   // Check the outline property
894
895   // Test string type first
896   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
897   label.SetProperty(TextLabel::Property::OUTLINE, "Outline properties");
898   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
899
900   // Then test the property map type
901   Property::Map outlineMapSet;
902   Property::Map outlineMapGet;
903
904   outlineMapSet["color"] = Color::RED;
905   outlineMapSet["width"] = 2.0f;
906   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
907
908   outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
909   DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
910   DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
911
912   outlineMapSet.Clear();
913   outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
914   outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
915   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
916
917   outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
918   DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
919   std::vector<std::string> outlineIndicesConversionTable = {"color", "width"};
920   DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet, outlineIndicesConversionTable), true, TEST_LOCATION);
921
922   // Check the background property
923   Property::Map backgroundMapSet;
924   Property::Map backgroundMapGet;
925
926   backgroundMapSet["enable"] = true;
927   backgroundMapSet["color"]  = Color::RED;
928   label.SetProperty(DevelTextLabel::Property::BACKGROUND, backgroundMapSet);
929
930   backgroundMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::BACKGROUND);
931   DALI_TEST_EQUALS(backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION);
932   DALI_TEST_EQUALS(DaliTestCheckMaps(backgroundMapGet, backgroundMapSet), true, TEST_LOCATION);
933
934   backgroundMapSet.Clear();
935   backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
936   backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR]  = Color::GREEN;
937   label.SetProperty(DevelTextLabel::Property::BACKGROUND, backgroundMapSet);
938
939   backgroundMapGet = label.GetProperty<Property::Map>(DevelTextLabel::Property::BACKGROUND);
940   DALI_TEST_EQUALS(backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION);
941   std::vector<std::string> backgroundIndicesConversionTable = {"enable", "color"};
942   DALI_TEST_EQUALS(DaliTestCheckMaps(backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable), true, TEST_LOCATION);
943
944   // Check the pixel size of font
945   label.SetProperty(TextLabel::Property::PIXEL_SIZE, 20.f);
946   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
947
948   // Check the ellipsis property
949   DALI_TEST_CHECK(label.GetProperty<bool>(TextLabel::Property::ELLIPSIS));
950   label.SetProperty(TextLabel::Property::ELLIPSIS, false);
951   DALI_TEST_CHECK(!label.GetProperty<bool>(TextLabel::Property::ELLIPSIS));
952
953   // Check the layout direction property
954   label.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
955   DALI_TEST_EQUALS(label.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
956
957   // Check the line size property
958   DALI_TEST_EQUALS(label.GetProperty<float>(DevelTextLabel::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
959   label.SetProperty(DevelTextLabel::Property::MIN_LINE_SIZE, 50.f);
960   DALI_TEST_EQUALS(label.GetProperty<float>(DevelTextLabel::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
961
962   application.SendNotification();
963   application.Render();
964
965   END_TEST;
966 }
967
968 int UtcDaliToolkitTextlabelAtlasRenderP(void)
969 {
970   ToolkitTestApplication application;
971   tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
972   TextLabel label = TextLabel::New("Test Text");
973   DALI_TEST_CHECK(label);
974
975   // Avoid a crash when core load gl resources.
976   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
977
978   application.GetScene().Add(label);
979
980   // Turn on all the effects
981   label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
982   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
983
984   Property::Map underlineMap;
985   underlineMap.Insert("enable", true);
986   underlineMap.Insert("color", Color::RED);
987   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMap);
988
989   Property::Map shadowMap;
990   shadowMap.Insert("color", Color::BLUE);
991   shadowMap.Insert("offset", Vector2(1.0f, 1.0f));
992   label.SetProperty(TextLabel::Property::SHADOW, shadowMap);
993
994   Property::Map strikethroughMap;
995   strikethroughMap.Insert("enable", true);
996   strikethroughMap.Insert("color", Color::GREEN);
997   strikethroughMap.Insert("height", 2.0f);
998   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap);
999
1000   try
1001   {
1002     // Render some text with the shared atlas backend
1003     label.SetProperty(DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1004     application.SendNotification();
1005     application.Render();
1006   }
1007   catch(...)
1008   {
1009     tet_result(TET_FAIL);
1010   }
1011
1012   try
1013   {
1014     // Render some text with the shared atlas backend
1015     label.SetProperty(DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED);
1016     application.SendNotification();
1017     application.Render();
1018   }
1019   catch(...)
1020   {
1021     tet_result(TET_FAIL);
1022   }
1023   END_TEST;
1024 }
1025
1026 int UtcDaliToolkitTextLabelLanguagesP(void)
1027 {
1028   ToolkitTestApplication application;
1029   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
1030   TextLabel label = TextLabel::New();
1031   DALI_TEST_CHECK(label);
1032
1033   application.GetScene().Add(label);
1034
1035   const std::string scripts(
1036     " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
1037     "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
1038     "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
1039     "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
1040     "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
1041     "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84."); // these characters on the last line are emojis.
1042
1043   label.SetProperty(TextLabel::Property::TEXT, scripts);
1044   DALI_TEST_EQUALS(label.GetProperty<std::string>(TextLabel::Property::TEXT), scripts, TEST_LOCATION);
1045
1046   application.SendNotification();
1047   application.Render();
1048
1049   END_TEST;
1050 }
1051
1052 int UtcDaliToolkitTextLabelEmojisP(void)
1053 {
1054   ToolkitTestApplication application;
1055   tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
1056   TextLabel label = TextLabel::New();
1057   DALI_TEST_CHECK(label);
1058
1059   application.GetScene().Add(label);
1060
1061   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1062
1063   char*             pathNamePtr = get_current_dir_name();
1064   const std::string pathName(pathNamePtr);
1065   free(pathNamePtr);
1066
1067   TextAbstraction::FontDescription fontDescription;
1068   fontDescription.path   = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
1069   fontDescription.family = "BreezeColorEmoji";
1070   fontDescription.width  = TextAbstraction::FontWidth::NONE;
1071   fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
1072   fontDescription.slant  = TextAbstraction::FontSlant::NONE;
1073
1074   fontClient.GetFontId(fontDescription, EMOJI_FONT_SIZE);
1075
1076   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>";
1077   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1078   label.SetProperty(TextLabel::Property::TEXT, emojis);
1079
1080   Property::Map shadowMap;
1081   shadowMap.Insert("color", "green");
1082   shadowMap.Insert("offset", "2 2");
1083   label.SetProperty(TextLabel::Property::SHADOW, shadowMap);
1084
1085   application.SendNotification();
1086   application.Render();
1087
1088   // EMOJI + ZWJ + EMOJI case for coverage.
1089   const std::string emojiWithZWJ = "&#x1f469;&#x200d;&#x1f52c;";
1090   label.SetProperty(TextLabel::Property::TEXT, emojiWithZWJ);
1091
1092   application.SendNotification();
1093   application.Render();
1094
1095   // EMOJI Sequences case for coverage.
1096   std::string emojiSequences =
1097     "Text VS15 &#x262a;&#xfe0e;\n"                                                         //text presentation sequence and selector
1098     "Color VS16 &#x262a;&#xfe0f;\n"                                                        //emoji presentation sequence and selector
1099     "Default &#x262a; \n"                                                                  //default presentation
1100     "FamilyManWomanGirlBoy &#x1F468;&#x200D;&#x1F469;&#x200D;&#x1F467;&#x200D;&#x1F466;\n" // emoji multi zwj sequence
1101     "WomanScientist &#x1f469;&#x200d;&#x1f52c;\n"                                          // emoji zwj sequence
1102     "WomanScientistLightSkinTone&#x1F469;&#x1F3FB;&#x200D;&#x1F52C; \n"                    //emoji modifier sequence: skin tone & JWZ
1103     "LeftRightArrowText&#x2194;&#xfe0e;\n"                                                 //text presentation sequence and selector
1104     "LeftRightArrowEmoji&#x2194;&#xfe0f;\n"                                                //emoji presentation sequence and selector
1105     "SouthKoreaFlag&#x1f1f0;&#x1f1f7;\n"                                                   //emoji flag sequence
1106     "JordanFlag&#x1f1ef;&#x1f1f4;\n"                                                       // emoji flag sequence
1107     "EnglandFlag&#x1F3F4;&#xE0067;&#xE0062;&#xE0065;&#xE006E;&#xE0067;&#xE007F;\n"         //emoji tag sequence like England flag
1108     "Runner &#x1f3c3;&#x200d;&#x27a1;&#xfe0f; \n"
1109     "VictoryHandMediumLightSkinTone:&#x270C;&#xFE0F;&#x1F3FC;\n"               //emoji modifier sequence: skin tone
1110     "RainbowFlag:&#x1F3F3;&#xFE0F;&#x200D;&#x1F308; \n"                        //emoji zwj sequence: Rainbow Flag
1111     "keycap# &#x0023;&#xFE0F;&#x20E3; \n"                                      // fully-qualified  emoji keycap sequence
1112     "keycap#_text &#x0023;&#x20E3; \n"                                         // unqualified emoji keycap sequence
1113     "keycap3 &#x0033;&#xfe0f;&#x20e3; \n"                                      // fully-qualified  emoji keycap sequence
1114     "keycap3_text &#x0033;&#x20e3; \n"                                         // unqualified emoji keycap sequence
1115     "two adjacent glyphs &#x262a;&#xfe0f;&#xfe0f;&#xfe0f;&#x262a;&#xfe0f;\n"   //This line should be rendered as two adjacent glyphs
1116     "Digit 8&#xfe0f; 8&#xfe0e; 8\n"                                            // should be rendered according to selector
1117     "Surfing Medium Skin Female:  &#x1f3c4;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;"; // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
1118
1119   label.SetProperty(TextLabel::Property::TEXT, emojiSequences);
1120   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1121   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
1122   label.SetProperty(TextLabel::Property::ELLIPSIS, false);
1123
1124   application.SendNotification();
1125   application.Render();
1126   END_TEST;
1127 }
1128
1129 int UtcDaliToolkitTextlabelScrollingP(void)
1130 {
1131   ToolkitTestApplication application;
1132   tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
1133   TextLabel labelImmediate = TextLabel::New("Some text to scroll");
1134   TextLabel labelFinished  = TextLabel::New("مرحبا بالعالم");
1135
1136   DALI_TEST_CHECK(labelImmediate);
1137   DALI_TEST_CHECK(labelFinished);
1138   // Avoid a crash when core load gl resources.
1139   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1140   application.GetScene().Add(labelImmediate);
1141   // Turn on all the effects
1142   labelImmediate.SetProperty(TextLabel::Property::MULTI_LINE, false);
1143   labelImmediate.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1144   labelImmediate.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1145   labelImmediate.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1146   labelImmediate.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1147
1148   application.GetScene().Add(labelFinished);
1149   // Turn on all the effects
1150   labelFinished.SetProperty(TextLabel::Property::MULTI_LINE, false);
1151   labelFinished.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1152   labelFinished.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1153   labelFinished.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1154   labelFinished.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
1155
1156   try
1157   {
1158     // Render some text with the shared atlas backend
1159     labelImmediate.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1160     labelFinished.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1161
1162     labelImmediate.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1163     labelFinished.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1164
1165     labelImmediate.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1166     labelFinished.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1167     application.SendNotification();
1168     application.Render();
1169
1170     labelImmediate.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1171     labelFinished.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1172     application.SendNotification();
1173     application.Render();
1174   }
1175   catch(...)
1176   {
1177     tet_result(TET_FAIL);
1178   }
1179
1180   END_TEST;
1181 }
1182
1183 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
1184 {
1185   ToolkitTestApplication application;
1186   TextLabel              labelShort = TextLabel::New("Some text to scroll");
1187   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!");
1188
1189   DALI_TEST_CHECK(labelShort);
1190   DALI_TEST_CHECK(labelLong);
1191   // Avoid a crash when core load gl resources.
1192   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1193   application.GetScene().Add(labelShort);
1194   // Turn on all the effects
1195   labelShort.SetProperty(TextLabel::Property::MULTI_LINE, false);
1196   labelShort.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1197   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1198   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1199   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1200   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1201
1202   application.GetScene().Add(labelLong);
1203   // Turn on all the effects
1204   labelLong.SetProperty(TextLabel::Property::MULTI_LINE, false);
1205   labelLong.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1206   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1207   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1208   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1209   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
1210
1211   try
1212   {
1213     // Render some text with the shared atlas backend
1214     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1215     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1216     application.SendNotification();
1217     application.Render();
1218
1219     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1220     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1221     application.SendNotification();
1222     application.Render();
1223   }
1224   catch(...)
1225   {
1226     tet_result(TET_FAIL);
1227   }
1228
1229   END_TEST;
1230 }
1231
1232 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
1233 {
1234   ToolkitTestApplication application;
1235   TextLabel              labelShort = TextLabel::New("مرحبا بالعالم");
1236   TextLabel              labelLong  = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1237
1238   DALI_TEST_CHECK(labelShort);
1239   DALI_TEST_CHECK(labelLong);
1240   // Avoid a crash when core load gl resources.
1241   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1242   application.GetScene().Add(labelShort);
1243   // Turn on all the effects
1244   labelShort.SetProperty(TextLabel::Property::MULTI_LINE, false);
1245   labelShort.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1246   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1247   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1248   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1249   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1250
1251   application.GetScene().Add(labelLong);
1252   // Turn on all the effects
1253   labelLong.SetProperty(TextLabel::Property::MULTI_LINE, false);
1254   labelLong.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1255   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1256   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1257   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1258   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
1259
1260   try
1261   {
1262     // Render some text with the shared atlas backend
1263     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1264     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1265     application.SendNotification();
1266     application.Render();
1267
1268     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1269     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1270     application.SendNotification();
1271     application.Render();
1272   }
1273   catch(...)
1274   {
1275     tet_result(TET_FAIL);
1276   }
1277
1278   END_TEST;
1279 }
1280
1281 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
1282 {
1283   ToolkitTestApplication application;
1284   TextLabel              labelShort = TextLabel::New("Some text to scroll");
1285   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!");
1286
1287   DALI_TEST_CHECK(labelShort);
1288   DALI_TEST_CHECK(labelLong);
1289   // Avoid a crash when core load gl resources.
1290   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1291   application.GetScene().Add(labelShort);
1292   // Turn on all the effects
1293   labelShort.SetProperty(TextLabel::Property::MULTI_LINE, false);
1294   labelShort.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "END");
1295   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1296   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1297   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1298   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1299
1300   application.GetScene().Add(labelLong);
1301   // Turn on all the effects
1302   labelLong.SetProperty(TextLabel::Property::MULTI_LINE, false);
1303   labelLong.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "END");
1304   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1305   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1306   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1307   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
1308
1309   try
1310   {
1311     // Render some text with the shared atlas backend
1312     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1313     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1314     application.SendNotification();
1315     application.Render();
1316
1317     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1318     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1319     application.SendNotification();
1320     application.Render();
1321   }
1322   catch(...)
1323   {
1324     tet_result(TET_FAIL);
1325   }
1326
1327   END_TEST;
1328 }
1329
1330 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
1331 {
1332   ToolkitTestApplication application;
1333   TextLabel              labelShort = TextLabel::New("مرحبا بالعالم");
1334   TextLabel              labelLong  = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1335
1336   DALI_TEST_CHECK(labelShort);
1337   DALI_TEST_CHECK(labelLong);
1338   // Avoid a crash when core load gl resources.
1339   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1340   application.GetScene().Add(labelShort);
1341   // Turn on all the effects
1342   labelShort.SetProperty(TextLabel::Property::MULTI_LINE, false);
1343   labelShort.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "END");
1344   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1345   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1346   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1347   labelShort.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1348
1349   application.GetScene().Add(labelLong);
1350   // Turn on all the effects
1351   labelLong.SetProperty(TextLabel::Property::MULTI_LINE, false);
1352   labelLong.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "END");
1353   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1354   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1355   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1356   labelLong.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP);
1357
1358   try
1359   {
1360     // Render some text with the shared atlas backend
1361     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1362     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1363     application.SendNotification();
1364     application.Render();
1365
1366     labelShort.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1367     labelLong.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1368     application.SendNotification();
1369     application.Render();
1370   }
1371   catch(...)
1372   {
1373     tet_result(TET_FAIL);
1374   }
1375
1376   END_TEST;
1377 }
1378
1379 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1380 {
1381   ToolkitTestApplication application;
1382   tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1383   TextLabel label = TextLabel::New("Some text to scroll");
1384   DALI_TEST_CHECK(label);
1385   // Avoid a crash when core load gl resources.
1386   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1387   application.GetScene().Add(label);
1388   label.SetProperty(Actor::Property::SIZE, Vector2(360.0f, 20.f));
1389   // Turn on all the effects
1390   label.SetProperty(TextLabel::Property::MULTI_LINE, false);
1391   label.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1392   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1393   label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1394
1395   // Render the text.
1396   application.SendNotification();
1397   application.Render();
1398
1399   unsigned int actorCount1 = label.GetChildCount();
1400   tet_printf("Initial actor count is(%d)\n", actorCount1);
1401
1402   try
1403   {
1404     // Render some text with the shared atlas backend
1405     label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1406     application.SendNotification();
1407     application.Render(2000);
1408
1409     unsigned int actorCount1 = label.GetChildCount();
1410     tet_printf("Actor count after scrolling is(%d)\n", actorCount1);
1411
1412     label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED);
1413
1414     // Render the text.
1415     application.SendNotification();
1416     application.Render();
1417
1418     unsigned int actorCount2 = label.GetChildCount();
1419     tet_printf("After changing color the actor count is(%d)\n", actorCount2);
1420
1421     DALI_TEST_EQUALS(actorCount1, actorCount2, TEST_LOCATION);
1422   }
1423   catch(...)
1424   {
1425     tet_result(TET_FAIL);
1426   }
1427
1428   END_TEST;
1429 }
1430
1431 int UtcDaliToolkitTextlabelScrollingN(void)
1432 {
1433   ToolkitTestApplication application;
1434   tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1435
1436   TextLabel label = TextLabel::New("Some text to scroll");
1437   DALI_TEST_CHECK(label);
1438
1439   application.GetScene().Add(label);
1440
1441   // Avoid a crash when core load gl resources.
1442   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1443
1444   // The text scrolling works only on single line text.
1445   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
1446
1447   // Turn on all the effects.
1448   label.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1449   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1450   label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1451
1452   // Enable the auto scrolling effect.
1453   label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1454
1455   // The auto scrolling shouldn't be enabled.
1456   const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>();
1457   DALI_TEST_CHECK(!enabled);
1458
1459   END_TEST;
1460 }
1461
1462 int UtcDaliToolkitTextlabelScrollingWithEllipsis(void)
1463 {
1464   ToolkitTestApplication application;
1465   tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis");
1466
1467   TextLabel label = TextLabel::New("Some text to scroll");
1468   DALI_TEST_CHECK(label);
1469
1470   application.GetScene().Add(label);
1471
1472   // Avoid a crash when core load gl resources.
1473   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1474
1475   // Turn on all the effects.
1476   label.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50.0f);
1477   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3);
1478   label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f);
1479
1480   try
1481   {
1482     // Enable the auto scrolling effect.
1483     label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true);
1484     label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE);
1485
1486     // Disable the ellipsis
1487     label.SetProperty(TextLabel::Property::ELLIPSIS, false);
1488
1489     // Render the text.
1490     application.SendNotification();
1491     application.Render();
1492
1493     // Stop auto scrolling
1494     label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false);
1495
1496     // Check the ellipsis property
1497     DALI_TEST_CHECK(!label.GetProperty<bool>(TextLabel::Property::ELLIPSIS));
1498   }
1499   catch(...)
1500   {
1501     tet_result(TET_FAIL);
1502   }
1503
1504   END_TEST;
1505 }
1506
1507 int UtcDaliToolkitTextlabelEllipsis(void)
1508 {
1509   ToolkitTestApplication application;
1510   tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1511
1512   TextLabel label = TextLabel::New("Hello world");
1513   DALI_TEST_CHECK(label);
1514
1515   // Avoid a crash when core load gl resources.
1516   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1517
1518   application.GetScene().Add(label);
1519
1520   // Turn on all the effects
1521   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1522   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1523   label.SetProperty(Actor::Property::SIZE, Vector2(360.0f, 10.f));
1524
1525   try
1526   {
1527     // Render the text.
1528     application.SendNotification();
1529     application.Render();
1530   }
1531   catch(...)
1532   {
1533     tet_result(TET_FAIL);
1534   }
1535
1536   label.SetProperty(TextLabel::Property::TEXT, "Hello world                                        ");
1537   label.SetProperty(DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false);
1538   label.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 10.f));
1539
1540   try
1541   {
1542     // Render the text.
1543     application.SendNotification();
1544     application.Render();
1545   }
1546   catch(...)
1547   {
1548     tet_result(TET_FAIL);
1549   }
1550
1551   label.SetProperty(TextLabel::Property::TEXT, "Hello world");
1552   label.SetProperty(DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true);
1553   label.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 10.f));
1554
1555   try
1556   {
1557     // Render the text.
1558     application.SendNotification();
1559     application.Render();
1560   }
1561   catch(...)
1562   {
1563     tet_result(TET_FAIL);
1564   }
1565
1566   END_TEST;
1567 }
1568
1569 int UtcDaliToolkitTextlabelTextWrapMode(void)
1570 {
1571   ToolkitTestApplication application;
1572   tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1573
1574   int lineCount = 0;
1575
1576   TextLabel label = TextLabel::New();
1577   label.SetProperty(Actor::Property::SIZE, Vector2(300.0f, 300.f));
1578   label.SetProperty(TextLabel::Property::TEXT, "Hello world Hello world");
1579   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
1580
1581   //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1582   application.GetScene().Add(label);
1583
1584   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "WORD");
1585   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
1586
1587   application.SendNotification();
1588   application.Render();
1589
1590   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
1591   DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
1592
1593   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
1594   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
1595
1596   application.SendNotification();
1597   application.Render();
1598
1599   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD);
1600   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
1601
1602   application.SendNotification();
1603   application.Render();
1604
1605   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
1606   DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
1607
1608   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER);
1609   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
1610
1611   application.SendNotification();
1612   application.Render();
1613
1614   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
1615   DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
1616
1617   tet_infoline("Ensure invalid string does not change wrapping mode");
1618   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode");
1619   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
1620
1621   END_TEST;
1622 }
1623
1624 int UtcDaliToolkitTextLabelColorComponents(void)
1625 {
1626   ToolkitTestApplication application;
1627
1628   TextLabel label = TextLabel::New();
1629   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED);
1630   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_RED), 1.0f, TEST_LOCATION);
1631   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_GREEN), 0.0f, TEST_LOCATION);
1632   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_BLUE), 0.0f, TEST_LOCATION);
1633   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_ALPHA), 1.0f, TEST_LOCATION);
1634
1635   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::GREEN);
1636   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_RED), 0.0f, TEST_LOCATION);
1637   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_GREEN), 1.0f, TEST_LOCATION);
1638   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_BLUE), 0.0f, TEST_LOCATION);
1639   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_ALPHA), 1.0f, TEST_LOCATION);
1640
1641   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::BLUE);
1642   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_RED), 0.0f, TEST_LOCATION);
1643   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_GREEN), 0.0f, TEST_LOCATION);
1644   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_BLUE), 1.0f, TEST_LOCATION);
1645   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_ALPHA), 1.0f, TEST_LOCATION);
1646
1647   label.SetProperty(TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f);
1648   DALI_TEST_EQUALS(label.GetProperty<float>(TextLabel::Property::TEXT_COLOR_ALPHA), 0.6f, TEST_LOCATION);
1649   DALI_TEST_EQUALS(label.GetProperty<Vector4>(TextLabel::Property::TEXT_COLOR), Vector4(0.0f, 0.0f, 1.0f, 0.6f), TEST_LOCATION);
1650
1651   // Test a transparent text - Rendering should be skipped.
1652   label.SetProperty(TextLabel::Property::TEXT, "Hello world Hello world");
1653   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::BLUE);
1654
1655   application.GetScene().Add(label);
1656
1657   TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1658   drawTrace.Enable(true);
1659
1660   application.SendNotification();
1661   application.Render();
1662
1663   DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION); // Should be rendered
1664
1665   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT);
1666
1667   drawTrace.Reset();
1668
1669   application.SendNotification();
1670   application.Render();
1671
1672   DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION); // Rendering should be skipped
1673
1674   label.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED);
1675
1676   drawTrace.Reset();
1677
1678   application.SendNotification();
1679   application.Render();
1680
1681   DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION); // Should be rendered again
1682
1683   END_TEST;
1684 }
1685
1686 int UtcDaliToolkitTextlabelTextStyle01(void)
1687 {
1688   ToolkitTestApplication application;
1689   tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1690
1691   TextLabel label = TextLabel::New();
1692   label.SetProperty(Actor::Property::SIZE, Vector2(300.0f, 300.f));
1693   label.SetProperty(TextLabel::Property::TEXT, "Hello world Hello world");
1694   label.SetProperty(TextLabel::Property::POINT_SIZE, 12);
1695   application.GetScene().Add(label);
1696
1697   Property::Map outlineMapSet;
1698   Property::Map outlineMapGet;
1699
1700   outlineMapSet["color"] = Color::BLUE;
1701   outlineMapSet["width"] = 2.0f;
1702   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
1703
1704   application.SendNotification();
1705   application.Render();
1706
1707   Property::Map shadowMapSet;
1708   shadowMapSet.Insert("color", "green");
1709   shadowMapSet.Insert("offset", "2 2");
1710   shadowMapSet.Insert("blurRadius", "3");
1711   label.SetProperty(TextLabel::Property::SHADOW, shadowMapSet);
1712
1713   outlineMapSet["color"] = Color::RED;
1714   outlineMapSet["width"] = 0.0f;
1715   label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
1716
1717   application.SendNotification();
1718   application.Render();
1719
1720   outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
1721
1722   Property::Value* colorValue = outlineMapGet.Find("color");
1723
1724   bool colorMatched(false);
1725
1726   if(colorValue)
1727   {
1728     Property::Type valueType = colorValue->GetType();
1729
1730     if(Property::STRING == valueType)
1731     {
1732       std::string stringValue;
1733       colorValue->Get(stringValue);
1734       if(stringValue == "red")
1735       {
1736         colorMatched = true;
1737       }
1738     }
1739     else if(Property::VECTOR4 == valueType)
1740     {
1741       Vector4 colorVector4;
1742       colorValue->Get(colorVector4);
1743       if(colorVector4 == Color::RED)
1744       {
1745         colorMatched = true;
1746       }
1747     }
1748   }
1749
1750   DALI_TEST_EQUALS(colorMatched, true, TEST_LOCATION);
1751
1752   END_TEST;
1753 }
1754
1755 int UtcDaliToolkitTextlabelMultiline(void)
1756 {
1757   ToolkitTestApplication application;
1758   tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1759
1760   TextLabel label = TextLabel::New();
1761   label.SetProperty(TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world");
1762   label.SetProperty(TextLabel::Property::POINT_SIZE, 20);
1763   label.SetProperty(TextLabel::Property::MULTI_LINE, false);
1764   application.GetScene().Add(label);
1765
1766   application.SendNotification();
1767   application.Render();
1768
1769   int lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
1770   DALI_TEST_EQUALS(lineCount, 1, TEST_LOCATION);
1771
1772   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
1773
1774   application.SendNotification();
1775   application.Render();
1776
1777   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
1778   DALI_TEST_EQUALS(true, (lineCount > 1), TEST_LOCATION);
1779
1780   END_TEST;
1781 }
1782
1783 int UtcDaliToolkitTextlabelTextDirection(void)
1784 {
1785   ToolkitTestApplication application;
1786   tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1787
1788   TextLabel label = TextLabel::New();
1789   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::TEXT_DIRECTION), static_cast<int>(Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT), TEST_LOCATION);
1790
1791   label.SetProperty(TextLabel::Property::TEXT, "Hello world");
1792   label.SetProperty(TextLabel::Property::POINT_SIZE, 20);
1793   label.SetProperty(DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false);
1794   application.GetScene().Add(label);
1795
1796   // Test LTR text
1797   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::TEXT_DIRECTION), static_cast<int>(Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT), TEST_LOCATION);
1798
1799   // Test RTL text
1800   label.SetProperty(TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ");
1801   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::TEXT_DIRECTION), static_cast<int>(Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1802
1803   // Test RTL text starting with weak character
1804   label.SetProperty(TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ");
1805   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::TEXT_DIRECTION), static_cast<int>(Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1806
1807   // Test RTL text string with emoji and weak character
1808   label.SetProperty(TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ");
1809   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::TEXT_DIRECTION), static_cast<int>(Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1810
1811   END_TEST;
1812 }
1813
1814 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1815 {
1816   ToolkitTestApplication application;
1817   tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1818
1819   TextLabel label = TextLabel::New();
1820
1821   label.SetProperty(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP);
1822   label.SetProperty(TextLabel::Property::TEXT, "Hello world");
1823   label.SetProperty(TextLabel::Property::POINT_SIZE, 15);
1824   label.SetProperty(TextLabel::Property::LINE_SPACING, 12);
1825   application.GetScene().Add(label);
1826   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT), static_cast<int>(Toolkit::DevelText::VerticalLineAlignment::TOP), TEST_LOCATION);
1827
1828   label.SetProperty(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE);
1829   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT), static_cast<int>(Toolkit::DevelText::VerticalLineAlignment::MIDDLE), TEST_LOCATION);
1830
1831   label.SetProperty(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM);
1832   DALI_TEST_EQUALS(label.GetProperty<int>(DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT), static_cast<int>(Toolkit::DevelText::VerticalLineAlignment::BOTTOM), TEST_LOCATION);
1833
1834   END_TEST;
1835 }
1836
1837 int UtcDaliToolkitTextLabelBitmapFont(void)
1838 {
1839   ToolkitTestApplication application;
1840   tet_infoline(" UtcDaliToolkitTextLabelBitmapFont");
1841
1842   DevelText::BitmapFontDescription fontDescription;
1843   fontDescription.name               = "Digits";
1844   fontDescription.underlinePosition  = 0.f;
1845   fontDescription.underlineThickness = 0.f;
1846
1847   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 34.f, 0.f});
1848   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f});
1849   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f});
1850   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0033.png", "2", 34.f, 0.f});
1851   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0034.png", "3", 34.f, 0.f});
1852   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0035.png", "4", 34.f, 0.f});
1853   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0036.png", "5", 34.f, 0.f});
1854   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0037.png", "6", 34.f, 0.f});
1855   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0038.png", "7", 34.f, 0.f});
1856   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0039.png", "8", 34.f, 0.f});
1857   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u003a.png", "9", 34.f, 0.f});
1858
1859   TextAbstraction::BitmapFont bitmapFont;
1860   DevelText::CreateBitmapFont(fontDescription, bitmapFont);
1861
1862   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1863   fontClient.GetFontId(bitmapFont);
1864
1865   TextLabel label = TextLabel::New();
1866
1867   label.SetProperty(TextLabel::Property::TEXT, "0123456789:");
1868   label.SetProperty(TextLabel::Property::FONT_FAMILY, "Digits");
1869
1870   // 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.
1871   DALI_TEST_EQUALS(label.GetNaturalSize(), Vector3(322.f, 34.f, 0.f), Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1872
1873   application.GetScene().Add(label);
1874
1875   application.SendNotification();
1876   application.Render();
1877
1878   // The text has been rendered if the height of the text-label is the height of the line.
1879   DALI_TEST_EQUALS(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1880
1881   END_TEST;
1882 }
1883
1884 int ConvertPointToPixel(float point)
1885 {
1886   unsigned int                horizontalDpi = 0u;
1887   unsigned int                verticalDpi   = 0u;
1888   TextAbstraction::FontClient fontClient    = TextAbstraction::FontClient::Get();
1889   fontClient.GetDpi(horizontalDpi, verticalDpi);
1890
1891   return (point * 72.f) / static_cast<float>(horizontalDpi);
1892 }
1893
1894 int UtcDaliToolkitTextlabelTextFit(void)
1895 {
1896   ToolkitTestApplication application;
1897   tet_infoline(" UtcDaliToolkitTextlabelTextFit");
1898   TextLabel label = TextLabel::New();
1899   Vector2   size(460.0f, 100.0f);
1900   label.SetProperty(Actor::Property::SIZE, size);
1901   label.SetProperty(TextLabel::Property::TEXT, "Hello world");
1902
1903   // connect to the text git changed signal.
1904   ConnectionTracker* testTracker = new ConnectionTracker();
1905   DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback);
1906   bool textFitChangedSignal = false;
1907   label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal));
1908   gTextFitChangedCallBackCalled = false;
1909
1910   // check point size
1911   Property::Map textFitMapSet;
1912   textFitMapSet["enable"]       = true;
1913   textFitMapSet["minSize"]      = 10.f;
1914   textFitMapSet["maxSize"]      = 100.f;
1915   textFitMapSet["stepSize"]     = -1.f;
1916   textFitMapSet["fontSizeType"] = "pointSize";
1917
1918   label.SetProperty(Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet);
1919   label.SetProperty(TextLabel::Property::POINT_SIZE, 120.f);
1920
1921   application.GetScene().Add(label);
1922
1923   application.SendNotification();
1924   application.Render();
1925
1926   const Vector3 EXPECTED_NATURAL_SIZE(450.0f, 96.0f, 0.0f);
1927   DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION);
1928
1929   DALI_TEST_CHECK(gTextFitChangedCallBackCalled);
1930   DALI_TEST_CHECK(textFitChangedSignal);
1931
1932   // check pixel size
1933   textFitMapSet.Clear();
1934   textFitMapSet["enable"]       = true;
1935   textFitMapSet["minSize"]      = ConvertPointToPixel(10.f);
1936   textFitMapSet["maxSize"]      = ConvertPointToPixel(100.f);
1937   textFitMapSet["stepSize"]     = ConvertPointToPixel(1.f);
1938   textFitMapSet["fontSizeType"] = "pixelSize";
1939
1940   label.SetProperty(Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet);
1941
1942   application.SendNotification();
1943   application.Render();
1944
1945   DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION);
1946
1947   END_TEST;
1948 }
1949
1950 int UtcDaliToolkitTextlabelMaxTextureSet(void)
1951 {
1952   ToolkitTestApplication application;
1953   tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
1954
1955   DevelText::BitmapFontDescription fontDescription;
1956   fontDescription.name = "Digits";
1957   fontDescription.glyphs.push_back({TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f});
1958
1959   TextAbstraction::BitmapFont bitmapFont;
1960   DevelText::CreateBitmapFont(fontDescription, bitmapFont);
1961
1962   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1963   fontClient.GetFontId(bitmapFont);
1964
1965   TextLabel label = TextLabel::New();
1966   label.SetProperty(TextLabel::Property::FONT_FAMILY, "Digits");
1967   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1968   label.SetProperty(TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded.");
1969   label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
1970   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
1971
1972   Property::Map underlineMapSet;
1973   underlineMapSet.Clear();
1974   underlineMapSet.Insert("enable", true);
1975   underlineMapSet.Insert("color", Color::RED);
1976   underlineMapSet.Insert("height", 1);
1977   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
1978   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
1979
1980   Property::Map strikethroughMapSet;
1981   strikethroughMapSet.Clear();
1982   strikethroughMapSet.Insert("enable", true);
1983   strikethroughMapSet.Insert("color", Color::RED);
1984   strikethroughMapSet.Insert("height", 2.0f);
1985   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
1986   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
1987
1988   application.GetScene().Add(label);
1989
1990   application.SendNotification();
1991   application.Render();
1992
1993   const int maxTextureSize = Dali::GetMaxTextureSize();
1994   // Whether the rendered text is greater than maxTextureSize
1995   DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
1996
1997   // Check if the number of renderers is greater than 1.
1998   DALI_TEST_CHECK(label.GetRendererCount() > 1u);
1999
2000   //DASHED
2001   underlineMapSet.Clear();
2002   underlineMapSet.Insert("enable", false);
2003   underlineMapSet.Insert("color", Color::BLUE);
2004   underlineMapSet.Insert("height", 0);
2005   underlineMapSet.Insert("type", Text::Underline::DASHED);
2006   underlineMapSet.Insert("dashWidth", 2);
2007   underlineMapSet.Insert("dashGap", 1);
2008   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
2009   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2010
2011   application.GetScene().Add(label);
2012
2013   application.SendNotification();
2014   application.Render();
2015
2016   // Whether the rendered text is greater than maxTextureSize
2017   DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
2018
2019   // Check if the number of renderers is greater than 1.
2020   DALI_TEST_CHECK(label.GetRendererCount() > 1u);
2021
2022   //DOUBLE
2023   underlineMapSet.Clear();
2024   underlineMapSet.Insert("enable", false);
2025   underlineMapSet.Insert("color", Color::BLUE);
2026   underlineMapSet.Insert("height", 0);
2027   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2028   underlineMapSet.Insert("dashWidth", 2);
2029   underlineMapSet.Insert("dashGap", 1);
2030   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
2031   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2032
2033   application.GetScene().Add(label);
2034
2035   application.SendNotification();
2036   application.Render();
2037
2038   // Whether the rendered text is greater than maxTextureSize
2039   DALI_TEST_CHECK(label.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height > maxTextureSize);
2040
2041   // Check if the number of renderers is greater than 1.
2042   DALI_TEST_CHECK(label.GetRendererCount() > 1u);
2043
2044   END_TEST;
2045 }
2046
2047 int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
2048 {
2049   ToolkitTestApplication application;
2050   tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
2051
2052   TextLabel label = TextLabel::New();
2053   label.SetProperty(TextLabel::Property::TEXT, "Test");
2054   label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2055   //Exeeding BufferWidth
2056   label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
2057   label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
2058   label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
2059
2060   application.GetScene().Add(label);
2061   application.SendNotification();
2062   application.Render();
2063
2064   Property::Map strikethroughMapSet;
2065   strikethroughMapSet.Clear();
2066   strikethroughMapSet.Insert("enable", true);
2067   strikethroughMapSet.Insert("color", Color::BLUE);
2068   strikethroughMapSet.Insert("height", 2.0f);
2069   label.SetProperty(TextLabel::Property::TEXT, "Test1");
2070   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
2071   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2072   application.GetScene().Add(label);
2073   application.SendNotification();
2074   application.Render();
2075   // Check if the number of renderers is 1.
2076   DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
2077
2078   label = TextLabel::New();
2079   label.SetProperty(TextLabel::Property::TEXT, "Test");
2080   label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2081
2082   //Exeeding BufferHeight
2083   label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
2084   label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
2085   label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
2086
2087   application.GetScene().Add(label);
2088   application.SendNotification();
2089   application.Render();
2090
2091   strikethroughMapSet.Clear();
2092   strikethroughMapSet.Insert("enable", true);
2093   strikethroughMapSet.Insert("color", Color::BLUE);
2094   strikethroughMapSet.Insert("height", 2.0f);
2095   label.SetProperty(TextLabel::Property::TEXT, "Test2");
2096   label.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
2097   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2098   application.GetScene().Add(label);
2099   application.SendNotification();
2100   application.Render();
2101   // Check if the number of renderers is 1.
2102   DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
2103
2104   END_TEST;
2105 }
2106
2107 int UtcDaliToolkitTextlabelUnderlineExceedsWidth(void)
2108 {
2109   ToolkitTestApplication application;
2110   tet_infoline(" UtcDaliToolkitTextlabelUnderlineExceedsWidth");
2111
2112   TextLabel label = TextLabel::New();
2113   label.SetProperty(TextLabel::Property::TEXT, "Test");
2114   label.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2115   //Exeeding BufferWidth
2116   label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
2117   label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
2118   label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
2119
2120   application.GetScene().Add(label);
2121   application.SendNotification();
2122   application.Render();
2123
2124   Property::Map underlineMapSet;
2125
2126   //SOLID
2127   underlineMapSet.Clear();
2128   underlineMapSet.Insert("enable", true);
2129   underlineMapSet.Insert("color", Color::BLUE);
2130   underlineMapSet.Insert("height", 1);
2131   underlineMapSet.Insert("type", Text::Underline::SOLID);
2132   underlineMapSet.Insert("dashWidth", 2);
2133   underlineMapSet.Insert("dashGap", 1);
2134   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
2135   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2136
2137   application.GetScene().Add(label);
2138
2139   application.SendNotification();
2140   application.Render();
2141
2142   // Check if the number of renderers is 1.
2143   DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
2144
2145   //DASHED
2146   underlineMapSet.Clear();
2147   underlineMapSet.Insert("enable", true);
2148   underlineMapSet.Insert("color", Color::BLUE);
2149   underlineMapSet.Insert("height", 1);
2150   underlineMapSet.Insert("type", Text::Underline::DASHED);
2151   underlineMapSet.Insert("dashWidth", 2);
2152   underlineMapSet.Insert("dashGap", 1);
2153   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
2154   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2155
2156   application.GetScene().Add(label);
2157
2158   application.SendNotification();
2159   application.Render();
2160
2161   // Check if the number of renderers is 1.
2162   DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
2163
2164   //DOUBLE
2165   underlineMapSet.Clear();
2166   underlineMapSet.Insert("enable", true);
2167   underlineMapSet.Insert("color", Color::BLUE);
2168   underlineMapSet.Insert("height", 1);
2169   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2170   underlineMapSet.Insert("dashWidth", 2);
2171   underlineMapSet.Insert("dashGap", 1);
2172   label.SetProperty(TextLabel::Property::UNDERLINE, underlineMapSet);
2173   label.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE);
2174
2175   application.GetScene().Add(label);
2176
2177   application.SendNotification();
2178   application.Render();
2179
2180   // Check if the number of renderers is 1.
2181   DALI_TEST_EQUALS(1, label.GetRendererCount(), TEST_LOCATION);
2182
2183   END_TEST;
2184 }
2185
2186 int UtcDaliToolkitTextlabelLastCharacterIndex(void)
2187 {
2188   ToolkitTestApplication application;
2189   tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
2190
2191   Vector2 size(300.0f, 100.0f);
2192
2193   Dali::Toolkit::DevelText::RendererParameters textParameters;
2194   textParameters.text              = "This is a sample text to get the last index.";
2195   textParameters.layout            = "multiLine";
2196   textParameters.fontSize          = 20.f;
2197   textParameters.textWidth         = 300u;
2198   textParameters.textHeight        = 100u;
2199   textParameters.ellipsisEnabled   = true;
2200   Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex(textParameters);
2201
2202   DALI_TEST_CHECK(!indexArray.Empty());
2203   DALI_TEST_EQUALS(indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION);
2204
2205   END_TEST;
2206 }
2207
2208 int UtcDaliToolkitTextlabelFontSizeScale(void)
2209 {
2210   ToolkitTestApplication application;
2211   tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
2212
2213   TextLabel label = TextLabel::New();
2214   label.SetProperty(TextLabel::Property::POINT_SIZE, 30.f);
2215   label.SetProperty(TextLabel::Property::TEXT, "Test");
2216   Vector3 nonScaledSize = label.GetNaturalSize();
2217
2218   TextLabel labelScaled = TextLabel::New();
2219   labelScaled.SetProperty(TextLabel::Property::POINT_SIZE, 15.f);
2220   labelScaled.SetProperty(Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f);
2221   labelScaled.SetProperty(TextLabel::Property::TEXT, "Test");
2222   Vector3 scaledSize = labelScaled.GetNaturalSize();
2223
2224   DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
2225
2226   label.SetProperty(TextLabel::Property::PIXEL_SIZE, 30.f);
2227   label.SetProperty(TextLabel::Property::TEXT, "Test");
2228   nonScaledSize = label.GetNaturalSize();
2229
2230   labelScaled.SetProperty(TextLabel::Property::PIXEL_SIZE, 15.f);
2231   labelScaled.SetProperty(Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f);
2232   labelScaled.SetProperty(TextLabel::Property::TEXT, "Test");
2233   scaledSize = labelScaled.GetNaturalSize();
2234
2235   DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
2236
2237   END_TEST;
2238 }
2239
2240 // Positive test for the anchorClicked signal.
2241 int UtcDaliToolkitTextlabelAnchorClicked(void)
2242 {
2243   ToolkitTestApplication application;
2244   tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
2245   TextLabel label = TextLabel::New();
2246   DALI_TEST_CHECK(label);
2247
2248   application.GetScene().Add(label);
2249
2250   // connect to the anchor clicked signal.
2251   ConnectionTracker* testTracker = new ConnectionTracker();
2252   DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
2253   bool anchorClickedSignal = false;
2254   label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
2255
2256   gAnchorClickedCallBackCalled = false;
2257   label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
2258   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2259   label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2260   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2261   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2262
2263   application.SendNotification();
2264   application.Render();
2265
2266   // Create a tap event to touch the text label.
2267   TestGenerateTap(application, 5.0f, 25.0f, 100);
2268   application.SendNotification();
2269   application.Render();
2270
2271   DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
2272   DALI_TEST_CHECK(anchorClickedSignal);
2273
2274   // reset
2275   gAnchorClickedCallBackCalled = false;
2276   anchorClickedSignal          = false;
2277   label.SetProperty(TextLabel::Property::TEXT, "");
2278   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, false);
2279
2280   application.SendNotification();
2281   application.Render();
2282
2283   // sets anchor text
2284   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2285   label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
2286   label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2287   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2288   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2289
2290   application.SendNotification();
2291   application.Render();
2292
2293   // Create a tap event to touch the text label.
2294   TestGenerateTap(application, 5.0f, 25.0f, 200);
2295   application.SendNotification();
2296   application.Render();
2297
2298   DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
2299   DALI_TEST_CHECK(anchorClickedSignal);
2300
2301   gAnchorClickedCallBackNotCalled = true;
2302   // Tap the outside of anchor, callback should not be called.
2303   TestGenerateTap(application, 150.f, 100.f, 300);
2304   application.SendNotification();
2305   application.Render();
2306
2307   DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
2308
2309   END_TEST;
2310 }
2311
2312 int UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize(void)
2313 {
2314   ToolkitTestApplication application;
2315   tet_infoline(" UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize ");
2316
2317   //TextLabel is not using Atlas but this is to unify font-size on text-controllers
2318
2319   // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
2320   const uint32_t lessThanWidth  = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2321   const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2322
2323   // Create a text editor
2324   TextLabel textLabel = TextLabel::New();
2325   //Set size to avoid automatic eliding
2326   textLabel.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
2327   //Set very large font-size using point-size
2328   textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 1000);
2329   //Specify font-family
2330   textLabel.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2331   //Set text to check if appear or not
2332   textLabel.SetProperty(TextLabel::Property::TEXT, "A");
2333
2334   application.GetScene().Add(textLabel);
2335
2336   application.SendNotification();
2337   application.Render();
2338   //Use GetNaturalSize to verify that size of block does not exceed Atlas size
2339   Vector3 naturalSize = textLabel.GetNaturalSize();
2340
2341   DALI_TEST_GREATER(lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION);
2342   DALI_TEST_GREATER(lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION);
2343
2344   END_TEST;
2345 }
2346
2347 int UtcDaliTextLabelHyphenWrapMode(void)
2348 {
2349   ToolkitTestApplication application;
2350   tet_infoline(" UtcDaliTextLabelHyphenWrapMode ");
2351
2352   int       lineCount = 0;
2353   TextLabel label     = TextLabel::New();
2354   label.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
2355   label.SetProperty(TextLabel::Property::POINT_SIZE, 12.f);
2356   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
2357   application.GetScene().Add(label);
2358   application.SendNotification();
2359   application.Render();
2360
2361   label.SetProperty(TextLabel::Property::TEXT, "Hi Experimen");
2362   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, DevelText::LineWrap::HYPHENATION);
2363   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::HYPHENATION), TEST_LOCATION);
2364
2365   application.SendNotification();
2366   application.Render();
2367
2368   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
2369   /*
2370     text will be :
2371     Hi Exp-
2372     erimen
2373   */
2374   DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
2375
2376   label.SetProperty(TextLabel::Property::TEXT, "Hi Experimen");
2377   label.SetProperty(TextLabel::Property::LINE_WRAP_MODE, DevelText::LineWrap::MIXED);
2378   DALI_TEST_EQUALS(label.GetProperty<int>(TextLabel::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::MIXED), TEST_LOCATION);
2379
2380   application.SendNotification();
2381   application.Render();
2382
2383   lineCount = label.GetProperty<int>(TextLabel::Property::LINE_COUNT);
2384   /*
2385     text will be :
2386     Hi
2387     Experi-
2388     men
2389   */
2390   DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
2391
2392   END_TEST;
2393 }
2394
2395 int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
2396 {
2397   ToolkitTestApplication application;
2398
2399   tet_infoline(" utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged ");
2400
2401   int lineCountBefore = 0;
2402   int lineCountAfter  = 0;
2403
2404   // Create a text editor
2405   TextLabel textLabel = TextLabel::New();
2406   //Set very large font-size using point-size
2407   textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 10);
2408   //Specify font-family
2409   textLabel.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2410   //Specify size
2411   textLabel.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.f));
2412   //Set text longer than width of textLabel
2413   textLabel.SetProperty(TextLabel::Property::TEXT, "Short text");
2414   //Set line wrap mode Character
2415   textLabel.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
2416   textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
2417
2418   application.GetScene().Add(textLabel);
2419
2420   application.SendNotification();
2421   application.Render();
2422
2423   lineCountBefore = textLabel.GetProperty<int>(TextLabel::Property::LINE_COUNT);
2424
2425   textLabel.SetProperty(TextLabel::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
2426   lineCountAfter = textLabel.GetProperty<int>(TextLabel::Property::LINE_COUNT);
2427
2428   // When the text changed, the Line-count should be updated according to new text.
2429   // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
2430   DALI_TEST_EQUALS(lineCountBefore, 1, TEST_LOCATION);
2431   DALI_TEST_GREATER(lineCountAfter, 1, TEST_LOCATION);
2432
2433   END_TEST;
2434 }
2435
2436 int utcDaliTextLabelGeometryRTL(void)
2437 {
2438   ToolkitTestApplication application;
2439   tet_infoline(" utcDaliTextLabelGeometryRTL");
2440
2441   TextLabel label = TextLabel::New();
2442   DALI_TEST_CHECK(label);
2443
2444   application.GetScene().Add(label);
2445
2446   label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f);
2447   label.SetProperty(Actor::Property::SIZE, Vector2(150.f, 100.f));
2448   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2449   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2450   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2451   label.SetProperty(TextLabel::Property::MULTI_LINE, true);
2452   label.SetProperty(TextLabel::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر");
2453
2454   // Avoid a crash when core load gl resources.
2455   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2456
2457   // Render and notify
2458   application.SendNotification();
2459   application.Render();
2460
2461   unsigned int expectedCount = 4;
2462   unsigned int startIndex    = 3;
2463   unsigned int endIndex      = 24;
2464
2465   Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2466   Vector<Vector2> sizeList      = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2467
2468   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2469   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2470
2471   Vector<Vector2> expectedSizes;
2472   Vector<Vector2> expectedPositions;
2473
2474   expectedPositions.PushBack(Vector2(24, 0));
2475   expectedSizes.PushBack(Vector2(33, 25));
2476
2477   expectedPositions.PushBack(Vector2(-1, 25));
2478   expectedSizes.PushBack(Vector2(52, 25));
2479
2480   expectedPositions.PushBack(Vector2(-1, 50));
2481   expectedSizes.PushBack(Vector2(59, 25));
2482
2483   expectedPositions.PushBack(Vector2(73, 75));
2484   expectedSizes.PushBack(Vector2(37, 25));
2485
2486   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2487
2488   END_TEST;
2489 }
2490
2491 int utcDaliTextLabelGeometryGlyphMiddle(void)
2492 {
2493   ToolkitTestApplication application;
2494   tet_infoline(" utcDaliTextLabelGeometryGlyphMiddle");
2495
2496   TextLabel label = TextLabel::New();
2497   DALI_TEST_CHECK(label);
2498
2499   application.GetScene().Add(label);
2500
2501   label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f);
2502   label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
2503   label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2504   label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2505   label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2506   label.SetProperty(TextLabel::Property::TEXT, "لا تحتوي على لا");
2507
2508   // Avoid a crash when core load gl resources.
2509   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2510
2511   // Render and notify
2512   application.SendNotification();
2513   application.Render();
2514
2515   unsigned int expectedCount = 1;
2516   unsigned int startIndex    = 1;
2517   unsigned int endIndex      = 13;
2518
2519   Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2520   Vector<Vector2> sizeList      = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2521
2522   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2523   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2524
2525   Vector<Vector2> expectedSizes;
2526   Vector<Vector2> expectedPositions;
2527
2528   expectedPositions.PushBack(Vector2(12, 0));
2529   expectedSizes.PushBack(Vector2(118, 25));
2530
2531   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2532
2533   END_TEST;
2534 }
2535
2536 int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
2537 {
2538   ToolkitTestApplication application;
2539   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
2540   TextLabel textLabel = TextLabel::New();
2541
2542   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
2543   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
2544
2545   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
2546   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
2547   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
2548
2549   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
2550   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
2551   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
2552
2553   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
2554   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
2555   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
2556
2557   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
2558   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
2559   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
2560
2561   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
2562   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
2563   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
2564
2565   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
2566   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
2567   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
2568
2569   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
2570   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
2571   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
2572
2573   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
2574   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
2575   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
2576
2577   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
2578   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
2579   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
2580
2581   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
2582   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
2583   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
2584
2585   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
2586   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
2587   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
2588
2589   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
2590   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
2591   DALI_TEST_EQUALS(textLabel.GetProperty<int>(DevelTextLabel::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
2592
2593   END_TEST;
2594 }
2595
2596 int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
2597 {
2598   ToolkitTestApplication application;
2599   tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
2600
2601   TextLabel textLabel = TextLabel::New();
2602   textLabel.SetProperty(TextLabel::Property::TEXT, "Test");
2603   textLabel.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
2604   textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 10);
2605   textLabel.SetProperty(TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2606
2607   application.GetScene().Add(textLabel);
2608   application.SendNotification();
2609   application.Render();
2610
2611   Property::Map strikethroughMapSet;
2612   Property::Map strikethroughMapGet;
2613
2614   strikethroughMapSet.Insert("enable", true);
2615   strikethroughMapSet.Insert("color", Color::RED);
2616   strikethroughMapSet.Insert("height", 2.0f);
2617
2618   // Check the strikethrough property
2619   textLabel.SetProperty(DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet);
2620   strikethroughMapGet = textLabel.GetProperty<Property::Map>(DevelTextLabel::Property::STRIKETHROUGH);
2621   textLabel.SetProperty(TextLabel::Property::TEXT, "Test1");
2622   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
2623   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
2624
2625   // Render and notify
2626   application.SendNotification();
2627   application.Render();
2628
2629   strikethroughMapSet.Clear();
2630   strikethroughMapGet.Clear();
2631
2632   END_TEST;
2633 }
2634
2635 int UtcDaliTextLabelCharacterSpacing(void)
2636 {
2637   ToolkitTestApplication application;
2638   tet_infoline(" UtcDaliTextLabelCharacterSpacing ");
2639
2640   TextLabel textLabel = TextLabel::New();
2641
2642   textLabel.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
2643
2644   application.GetScene().Add(textLabel);
2645   application.SendNotification();
2646   application.Render();
2647
2648   textLabel.SetProperty(TextLabel::Property::TEXT, "Hi Experiment");
2649   textLabel.SetProperty(DevelTextLabel::Property::CHARACTER_SPACING, 10.f);
2650   DALI_TEST_EQUALS(textLabel.GetProperty<float>(DevelTextLabel::Property::CHARACTER_SPACING), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2651
2652   application.SendNotification();
2653   application.Render();
2654
2655   END_TEST;
2656 }