2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
25 #include <dali-toolkit/devel-api/controls/text-controls/text-style-properties-devel.h>
26 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
27 #include <dali/devel-api/text-abstraction/bitmap-font.h>
28 #include <dali/devel-api/text-abstraction/font-client.h>
29 #include <dali/devel-api/adaptor-framework/image-loading.h>
30 #include <dali-toolkit/devel-api/text/bitmap-font.h>
31 #include <dali-toolkit/devel-api/text/rendering-backend.h>
32 #include <dali-toolkit/devel-api/text/text-utils-devel.h>
33 #include "test-text-geometry-utils.h"
36 using namespace Toolkit;
38 void dali_textlabel_startup(void)
40 test_return_value = TET_UNDEF;
43 void dali_textlabel_cleanup(void)
45 test_return_value = TET_PASS;
51 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
52 const char* const PROPERTY_NAME_TEXT = "text";
53 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
54 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
55 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
56 const char* const PROPERTY_NAME_MULTI_LINE = "multiLine";
57 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
58 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
59 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
60 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
61 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
62 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
63 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
64 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
66 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
67 const char* const PROPERTY_NAME_UNDERLINE = "underline";
68 const char* const PROPERTY_NAME_SHADOW = "shadow";
69 const char* const PROPERTY_NAME_EMBOSS = "emboss";
70 const char* const PROPERTY_NAME_OUTLINE = "outline";
71 const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
72 const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
74 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
75 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
76 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
77 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
79 const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
81 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
82 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
84 static bool gAnchorClickedCallBackCalled;
85 static bool gAnchorClickedCallBackNotCalled;
87 static bool gTextFitChangedCallBackCalled;
89 struct CallbackFunctor
91 CallbackFunctor(bool* callbackFlag)
92 : mCallbackFlag( callbackFlag )
98 *mCallbackFlag = true;
103 static void TestAnchorClickedCallback(TextLabel control, const char* href, unsigned int hrefLength)
105 tet_infoline(" TestAnchorClickedCallback");
107 gAnchorClickedCallBackNotCalled = false;
109 if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
111 gAnchorClickedCallBackCalled = true;
115 static void TestTextFitChangedCallback(TextLabel control)
117 tet_infoline(" TestTextFitChangedCallback");
118 gTextFitChangedCallBackCalled = true;
121 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
123 const Property::Map::SizeType size = mapGet.Count();
125 if( size == mapSet.Count() )
127 for( unsigned int index = 0u; index < size; ++index )
129 const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
131 // Find the keys of the 'get' map
132 Property::Index indexKey = valueGet.first.indexKey;
133 std::string stringKey = valueGet.first.stringKey;
135 if( !indexConversionTable.empty() )
137 if( stringKey.empty() )
139 stringKey = indexConversionTable[ indexKey ];
142 if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
144 Property::Index index = 0u;
145 for( auto key : indexConversionTable )
147 if( key == stringKey )
157 const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
159 if( nullptr != valueSet )
161 if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
163 tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
166 else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
168 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
171 else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
173 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
176 else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
178 tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
181 else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
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 );
188 else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
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 );
198 if ( valueGet.first.type == Property::Key::INDEX )
200 tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
204 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
216 int UtcDaliToolkitTextLabelConstructorP(void)
218 ToolkitTestApplication application;
219 tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
221 DALI_TEST_CHECK( !textLabel );
225 int UtcDaliToolkitTextLabelNewP(void)
227 ToolkitTestApplication application;
228 tet_infoline(" UtcDaliToolkitTextLabelNewP");
229 TextLabel textLabel = TextLabel::New( "Test Text" );
230 DALI_TEST_CHECK( textLabel );
234 int UtcDaliToolkitTextLabelDownCastP(void)
236 ToolkitTestApplication application;
237 tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
238 TextLabel textLabel1 = TextLabel::New();
239 BaseHandle object( textLabel1 );
241 TextLabel textLabel2 = TextLabel::DownCast( object );
242 DALI_TEST_CHECK( textLabel2 );
244 TextLabel textLabel3 = DownCast< TextLabel >( object );
245 DALI_TEST_CHECK( textLabel3 );
249 int UtcDaliToolkitTextLabelDownCastN(void)
251 ToolkitTestApplication application;
252 tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
253 BaseHandle uninitializedObject;
254 TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
255 DALI_TEST_CHECK( !textLabel1 );
257 TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
258 DALI_TEST_CHECK( !textLabel2 );
262 int UtcDaliToolkitTextLabelCopyConstructorP(void)
264 ToolkitTestApplication application;
265 tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
266 TextLabel textLabel = TextLabel::New();
267 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
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 ) );
275 int UtcDaliTextLabelMoveConstructor(void)
277 ToolkitTestApplication application;
279 TextLabel textLabel = TextLabel::New();
280 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
281 DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
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 );
292 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
294 ToolkitTestApplication application;
295 tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
296 TextLabel textLabel = TextLabel::New();
297 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
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 ) );
305 int UtcDaliTextLabelMoveAssignment(void)
307 ToolkitTestApplication application;
309 TextLabel textLabel = TextLabel::New();
310 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
311 DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
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 );
323 // Positive test case for a method
324 int UtcDaliToolkitTextLabelGetPropertyP(void)
326 ToolkitTestApplication application;
327 tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
328 TextLabel label = TextLabel::New("Test Text");
329 DALI_TEST_CHECK( label );
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_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
357 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH );
362 int UtcDaliToolkitTextLabelSetPropertyP(void)
364 ToolkitTestApplication application;
365 tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
366 TextLabel label = TextLabel::New();
367 DALI_TEST_CHECK( label );
369 application.GetScene().Add( label );
371 // Note - we can't check the defaults since the stylesheets are platform-specific
372 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
373 DALI_TEST_EQUALS( (DevelText::RenderingType)label.GetProperty<int>( DevelTextLabel::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION );
375 // Check that text can be correctly reset
376 label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
377 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
379 // Check font properties.
380 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
381 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
383 Property::Map fontStyleMapSet;
384 Property::Map fontStyleMapGet;
386 fontStyleMapSet.Insert( "weight", "bold" );
387 fontStyleMapSet.Insert( "width", "condensed" );
388 fontStyleMapSet.Insert( "slant", "italic" );
389 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
391 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
392 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
393 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
395 // Check the old font style format.
396 fontStyleMapSet.Clear();
397 fontStyleMapSet.Insert( "weight", "thin" );
398 fontStyleMapSet.Insert( "width", "expanded" );
399 fontStyleMapSet.Insert( "slant", "oblique" );
400 const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
402 label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
403 std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
404 DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
406 label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
407 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
409 label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 2.5f );
410 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
411 label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
414 fontStyleMapSet.Clear();
415 fontStyleMapSet.Insert( "weight", "normal" );
416 fontStyleMapSet.Insert( "slant", "oblique" );
418 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
419 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
420 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
421 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
423 fontStyleMapSet.Clear();
424 fontStyleMapSet.Insert( "slant", "roman" );
426 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
427 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
428 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
430 // Replace 'roman' for 'normal'.
431 Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
432 if( NULL != slantValue )
434 if( "normal" == slantValue->Get<std::string>() )
436 fontStyleMapGet["slant"] = "roman";
439 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
441 fontStyleMapSet.Clear();
443 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
444 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
445 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
446 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
449 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
450 DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
452 // Check that the Alignment properties can be correctly set
453 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
454 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
455 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
456 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
458 // Check that text color can be properly set
459 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
460 DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
462 Property::Map strikethroughMapSet;
463 Property::Map strikethroughMapGet;
465 strikethroughMapSet.Insert( "enable", false );
466 strikethroughMapSet.Insert( "color", Color::BLUE );
467 strikethroughMapSet.Insert( "height", 2.0f );
469 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
471 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
472 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
473 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
475 Property::Map underlineMapSet;
476 Property::Map underlineMapGet;
478 underlineMapSet.Insert( "enable", false );
479 underlineMapSet.Insert( "color", Color::BLUE );
480 underlineMapSet.Insert( "height", 0 );
482 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
483 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
484 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
486 TextLabel label2 = TextLabel::New( "New text" );
487 DALI_TEST_CHECK( label2 );
488 DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
490 // Check the enable markup property.
491 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
492 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
493 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
495 // Check the text property when markup is enabled
496 label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
497 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
499 // Check for incomplete marks.
500 label.SetProperty( TextLabel::Property::TEXT, "<color='white'><i>Markup</i><b>Text</b></color>" );
501 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
504 application.SendNotification();
505 application.Render();
509 tet_result(TET_FAIL);
512 // Check autoscroll properties
513 const int SCROLL_SPEED = 80;
514 const int SCROLL_LOOPS = 4;
515 const float SCROLL_GAP = 50.0f;
516 const float SCROLL_LOOP_DELAY = 0.3f;
517 const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
518 const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
520 label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
521 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
522 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
523 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
524 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
525 DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
526 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
527 DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
528 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
529 DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
530 label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
531 DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
533 //Check autoscroll stop type property
534 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
535 DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
537 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
538 DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
540 // test natural size with multi-line and line spacing
542 TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
543 Vector3 oneLineNaturalSize = label3.GetNaturalSize();
544 label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
545 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
546 Vector3 multiLineNaturalSize = label3.GetNaturalSize();
548 // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
549 // The height of the text when multi-line is enabled will be larger
550 DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
551 DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
553 // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
554 // Everything else will remain the same
555 int lineSpacing = 20;
556 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
557 Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
558 expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
559 DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
562 // single line, line spacing must not affect natural size of the text, only add the spacing to the height
564 TextLabel label3 = TextLabel::New("Some text here end there end here");
565 label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
566 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
567 Vector3 textNaturalSize = label3.GetNaturalSize();
568 int lineSpacing = 20;
569 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
570 Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
571 expectedNaturalSizeWithLineSpacing.height += lineSpacing;
572 DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
574 // Check the line spacing property
575 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
576 label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
577 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
579 // Check the strikethrough property
580 strikethroughMapSet.Clear();
581 strikethroughMapSet.Insert( "enable", true );
582 strikethroughMapSet.Insert( "color", Color::RED );
583 strikethroughMapSet.Insert( "height", 2.0f );
585 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
587 application.SendNotification();
588 application.Render();
590 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
591 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
592 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
594 strikethroughMapSet.Clear();
595 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::ENABLE, true );
596 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED );
597 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f );
599 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
601 application.SendNotification();
602 application.Render();
604 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
605 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
606 std::vector<std::string> strikethroughIndicesConversionTable = { "enable", "color","height"};
607 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable ), true, TEST_LOCATION );
609 strikethroughMapSet.Clear();
611 Property::Map strikethroughDisabledMapGet;
612 strikethroughDisabledMapGet.Insert( "enable", false );
613 strikethroughDisabledMapGet.Insert( "color", Color::RED );
614 strikethroughDisabledMapGet.Insert( "height", 2.0f );
616 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
618 application.SendNotification();
619 application.Render();
621 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
622 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION );
623 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughDisabledMapGet ), true, TEST_LOCATION );
625 // Check the underline property
626 underlineMapSet.Clear();
627 underlineMapSet.Insert( "enable", true );
628 underlineMapSet.Insert( "color", Color::RED );
629 underlineMapSet.Insert( "height", 1 );
631 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
633 application.SendNotification();
634 application.Render();
636 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
637 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
638 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
640 underlineMapSet.Clear();
641 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true );
642 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN );
643 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 );
645 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
647 application.SendNotification();
648 application.Render();
650 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
651 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
652 std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
653 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
655 underlineMapSet.Clear();
657 Property::Map underlineDisabledMapGet;
658 underlineDisabledMapGet.Insert( "enable", false );
659 underlineDisabledMapGet.Insert( "color", Color::GREEN );
660 underlineDisabledMapGet.Insert( "height", 2 );
662 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
664 application.SendNotification();
665 application.Render();
667 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
668 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
669 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
671 // Check the shadow property
673 Property::Map shadowMapSet;
674 Property::Map shadowMapGet;
676 shadowMapSet.Insert( "color", Color::GREEN );
677 shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
678 shadowMapSet.Insert( "blurRadius", 5.0f );
680 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
682 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
683 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
684 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
686 shadowMapSet.Clear();
688 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
689 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
690 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
692 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
694 // Replace the offset (string) by a vector2
695 shadowMapSet.Clear();
696 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
697 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
698 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
700 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
701 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
702 std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
703 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
705 shadowMapSet.Clear();
706 Property::Map shadowDisabledMapGet;
707 shadowDisabledMapGet.Insert( "color", Color::BLUE );
708 shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
709 shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
711 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
713 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
714 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
715 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
717 // Check the emboss property
718 label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
719 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
721 // Check the outline property
723 // Test string type first
724 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
725 label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
726 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
728 // Then test the property map type
729 Property::Map outlineMapSet;
730 Property::Map outlineMapGet;
732 outlineMapSet["color"] = Color::RED;
733 outlineMapSet["width"] = 2.0f;
734 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
736 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
737 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
738 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
740 outlineMapSet.Clear();
741 outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
742 outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
743 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
745 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
746 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
747 std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
748 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
750 // Check the background property
751 Property::Map backgroundMapSet;
752 Property::Map backgroundMapGet;
754 backgroundMapSet["enable"] = true;
755 backgroundMapSet["color"] = Color::RED;
756 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
758 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
759 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
760 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
762 backgroundMapSet.Clear();
763 backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
764 backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
765 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
767 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
768 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
769 std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
770 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
772 // Check the pixel size of font
773 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
774 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
776 // Check the ellipsis property
777 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
778 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
779 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
781 // Check the layout direction property
782 label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
783 DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
785 // Check the line size property
786 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
787 label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f );
788 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
790 application.SendNotification();
791 application.Render();
796 int UtcDaliToolkitTextlabelAtlasRenderP(void)
798 ToolkitTestApplication application;
799 tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
800 TextLabel label = TextLabel::New("Test Text");
801 DALI_TEST_CHECK( label );
803 // Avoid a crash when core load gl resources.
804 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
806 application.GetScene().Add( label );
808 // Turn on all the effects
809 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
810 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
812 Property::Map underlineMap;
813 underlineMap.Insert( "enable", true );
814 underlineMap.Insert( "color", Color::RED );
815 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
817 Property::Map shadowMap;
818 shadowMap.Insert( "color", Color::BLUE );
819 shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
820 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
822 Property::Map strikethroughMap;
823 strikethroughMap.Insert( "enable", true );
824 strikethroughMap.Insert( "color", Color::GREEN );
825 strikethroughMap.Insert( "height", 2.0f );
826 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap );
830 // Render some text with the shared atlas backend
831 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
832 application.SendNotification();
833 application.Render();
837 tet_result(TET_FAIL);
842 // Render some text with the shared atlas backend
843 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED );
844 application.SendNotification();
845 application.Render();
849 tet_result(TET_FAIL);
854 int UtcDaliToolkitTextLabelLanguagesP(void)
856 ToolkitTestApplication application;
857 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
858 TextLabel label = TextLabel::New();
859 DALI_TEST_CHECK( label );
861 application.GetScene().Add( label );
863 const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
864 "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
865 "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
866 "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
867 "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
868 "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
870 label.SetProperty( TextLabel::Property::TEXT, scripts );
871 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
873 application.SendNotification();
874 application.Render();
879 int UtcDaliToolkitTextLabelEmojisP(void)
881 ToolkitTestApplication application;
882 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
883 TextLabel label = TextLabel::New();
884 DALI_TEST_CHECK( label );
886 application.GetScene().Add( label );
888 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
890 char* pathNamePtr = get_current_dir_name();
891 const std::string pathName( pathNamePtr );
894 TextAbstraction::FontDescription fontDescription;
895 fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
896 fontDescription.family = "BreezeColorEmoji";
897 fontDescription.width = TextAbstraction::FontWidth::NONE;
898 fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
899 fontDescription.slant = TextAbstraction::FontSlant::NONE;
901 fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
903 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>";
904 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
905 label.SetProperty( TextLabel::Property::TEXT, emojis );
907 Property::Map shadowMap;
908 shadowMap.Insert( "color", "green" );
909 shadowMap.Insert( "offset", "2 2" );
910 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
912 application.SendNotification();
913 application.Render();
915 // EMOJI + ZWJ + EMOJI case for coverage.
916 const std::string emojiWithZWJ = "👩‍🔬";
917 label.SetProperty( TextLabel::Property::TEXT, emojiWithZWJ );
919 application.SendNotification();
920 application.Render();
922 // EMOJI Sequences case for coverage.
923 std::string emojiSequences =
924 "Text VS15 ☪︎\n" //text presentation sequence and selector
925 "Color VS16 ☪️\n" //emoji presentation sequence and selector
926 "Default ☪ \n" //default presentation
927 "FamilyManWomanGirlBoy 👨‍👩‍👧‍👦\n" // emoji multi zwj sequence
928 "WomanScientist 👩‍🔬\n" // emoji zwj sequence
929 "WomanScientistLightSkinTone👩🏻‍🔬 \n" //emoji modifier sequence: skin tone & JWZ
930 "LeftRightArrowText↔︎\n" //text presentation sequence and selector
931 "LeftRightArrowEmoji↔️\n" //emoji presentation sequence and selector
932 "SouthKoreaFlag🇰🇷\n" //emoji flag sequence
933 "JordanFlag🇯🇴\n" // emoji flag sequence
934 "EnglandFlag🏴󠁧󠁢󠁥󠁮󠁧󠁿\n" //emoji tag sequence like England flag
935 "Runner 🏃‍➡️ \n"
936 "VictoryHandMediumLightSkinTone:✌️🏼\n" //emoji modifier sequence: skin tone
937 "RainbowFlag:🏳️‍🌈 \n" //emoji zwj sequence: Rainbow Flag
938 "keycap# #️⃣ \n" // fully-qualified emoji keycap sequence
939 "keycap#_text #⃣ \n" // unqualified emoji keycap sequence
940 "keycap3 3️⃣ \n" // fully-qualified emoji keycap sequence
941 "keycap3_text 3⃣ \n" // unqualified emoji keycap sequence
942 "two adjacent glyphs ☪️️️☪️\n" //This line should be rendered as two adjacent glyphs
943 "Digit 8️ 8︎ 8\n" // should be rendered according to selector
944 "Surfing Medium Skin Female: 🏄🏼‍♀️"; // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
946 label.SetProperty( TextLabel::Property::TEXT, emojiSequences );
947 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
948 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
949 label.SetProperty( TextLabel::Property::ELLIPSIS, false);
951 application.SendNotification();
952 application.Render();
956 int UtcDaliToolkitTextlabelScrollingP(void)
958 ToolkitTestApplication application;
959 tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
960 TextLabel labelImmediate = TextLabel::New("Some text to scroll");
961 TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
963 DALI_TEST_CHECK( labelImmediate );
964 DALI_TEST_CHECK( labelFinished );
965 // Avoid a crash when core load gl resources.
966 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
967 application.GetScene().Add( labelImmediate );
968 // Turn on all the effects
969 labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
970 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
971 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
972 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
973 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
975 application.GetScene().Add( labelFinished );
976 // Turn on all the effects
977 labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
978 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
979 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
980 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
981 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
987 // Render some text with the shared atlas backend
988 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
989 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
991 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
992 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
994 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
995 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
996 application.SendNotification();
997 application.Render();
999 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1000 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1001 application.SendNotification();
1002 application.Render();
1007 tet_result(TET_FAIL);
1013 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
1015 ToolkitTestApplication application;
1016 TextLabel labelShort = TextLabel::New("Some text to scroll");
1017 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!");
1019 DALI_TEST_CHECK( labelShort );
1020 DALI_TEST_CHECK( labelLong );
1021 // Avoid a crash when core load gl resources.
1022 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1023 application.GetScene().Add( labelShort );
1024 // Turn on all the effects
1025 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1026 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1027 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1028 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1029 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1030 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1032 application.GetScene().Add( labelLong );
1033 // Turn on all the effects
1034 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1035 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1036 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1037 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1038 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1039 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1043 // Render some text with the shared atlas backend
1044 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1045 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1046 application.SendNotification();
1047 application.Render();
1049 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1050 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1051 application.SendNotification();
1052 application.Render();
1057 tet_result(TET_FAIL);
1063 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
1065 ToolkitTestApplication application;
1066 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1067 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1069 DALI_TEST_CHECK( labelShort );
1070 DALI_TEST_CHECK( labelLong );
1071 // Avoid a crash when core load gl resources.
1072 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1073 application.GetScene().Add( labelShort );
1074 // Turn on all the effects
1075 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1076 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1077 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1078 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1079 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1080 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1082 application.GetScene().Add( labelLong );
1083 // Turn on all the effects
1084 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1085 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1086 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1087 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1088 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1089 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1093 // Render some text with the shared atlas backend
1094 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1095 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1096 application.SendNotification();
1097 application.Render();
1099 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1100 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1101 application.SendNotification();
1102 application.Render();
1107 tet_result(TET_FAIL);
1113 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
1115 ToolkitTestApplication application;
1116 TextLabel labelShort = TextLabel::New("Some text to scroll");
1117 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!");
1119 DALI_TEST_CHECK( labelShort );
1120 DALI_TEST_CHECK( labelLong );
1121 // Avoid a crash when core load gl resources.
1122 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1123 application.GetScene().Add( labelShort );
1124 // Turn on all the effects
1125 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1126 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1127 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1128 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1129 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1130 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1132 application.GetScene().Add( labelLong );
1133 // Turn on all the effects
1134 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1135 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1136 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1137 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1138 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1139 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1143 // Render some text with the shared atlas backend
1144 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1145 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1146 application.SendNotification();
1147 application.Render();
1149 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1150 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1151 application.SendNotification();
1152 application.Render();
1157 tet_result(TET_FAIL);
1163 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
1165 ToolkitTestApplication application;
1166 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1167 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1169 DALI_TEST_CHECK( labelShort );
1170 DALI_TEST_CHECK( labelLong );
1171 // Avoid a crash when core load gl resources.
1172 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1173 application.GetScene().Add( labelShort );
1174 // Turn on all the effects
1175 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1176 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1177 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1178 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1179 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1180 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1182 application.GetScene().Add( labelLong );
1183 // Turn on all the effects
1184 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1185 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1186 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1187 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1188 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1189 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1193 // Render some text with the shared atlas backend
1194 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1195 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1196 application.SendNotification();
1197 application.Render();
1199 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1200 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1201 application.SendNotification();
1202 application.Render();
1207 tet_result(TET_FAIL);
1213 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1215 ToolkitTestApplication application;
1216 tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1217 TextLabel label = TextLabel::New("Some text to scroll");
1218 DALI_TEST_CHECK( label );
1219 // Avoid a crash when core load gl resources.
1220 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1221 application.GetScene().Add( label );
1222 label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 20.f ) );
1223 // Turn on all the effects
1224 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1225 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1226 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1227 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1230 application.SendNotification();
1231 application.Render();
1233 unsigned int actorCount1 = label.GetChildCount();
1234 tet_printf("Initial actor count is(%d)\n", actorCount1 );
1238 // Render some text with the shared atlas backend
1239 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1240 application.SendNotification();
1241 application.Render(2000);
1243 unsigned int actorCount1 = label.GetChildCount();
1244 tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1246 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1249 application.SendNotification();
1250 application.Render();
1252 unsigned int actorCount2 = label.GetChildCount();
1253 tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1255 DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1260 tet_result(TET_FAIL);
1266 int UtcDaliToolkitTextlabelScrollingN(void)
1268 ToolkitTestApplication application;
1269 tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1271 TextLabel label = TextLabel::New("Some text to scroll");
1272 DALI_TEST_CHECK( label );
1274 application.GetScene().Add( label );
1276 // Avoid a crash when core load gl resources.
1277 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1279 // The text scrolling works only on single line text.
1280 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1282 // Turn on all the effects.
1283 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1284 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1285 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1287 // Enable the auto scrolling effect.
1288 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1290 // The auto scrolling shouldn't be enabled.
1291 const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1292 DALI_TEST_CHECK( !enabled );
1297 int UtcDaliToolkitTextlabelScrollingWithEllipsis(void)
1299 ToolkitTestApplication application;
1300 tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis");
1302 TextLabel label = TextLabel::New("Some text to scroll");
1303 DALI_TEST_CHECK( label );
1305 application.GetScene().Add( label );
1307 // Avoid a crash when core load gl resources.
1308 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1310 // Turn on all the effects.
1311 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1312 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1313 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1317 // Enable the auto scrolling effect.
1318 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1319 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1321 // Disable the ellipsis
1322 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
1325 application.SendNotification();
1326 application.Render();
1328 // Stop auto scrolling
1329 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1331 // Check the ellipsis property
1332 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
1336 tet_result(TET_FAIL);
1342 int UtcDaliToolkitTextlabelEllipsis(void)
1344 ToolkitTestApplication application;
1345 tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1347 TextLabel label = TextLabel::New("Hello world");
1348 DALI_TEST_CHECK( label );
1350 // Avoid a crash when core load gl resources.
1351 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1353 application.GetScene().Add( label );
1355 // Turn on all the effects
1356 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1357 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1358 label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 10.f ) );
1363 application.SendNotification();
1364 application.Render();
1368 tet_result(TET_FAIL);
1371 label.SetProperty( TextLabel::Property::TEXT, "Hello world " );
1372 label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1373 label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1378 application.SendNotification();
1379 application.Render();
1383 tet_result(TET_FAIL);
1387 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1388 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1389 label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1394 application.SendNotification();
1395 application.Render();
1399 tet_result(TET_FAIL);
1405 int UtcDaliToolkitTextlabelTextWrapMode(void)
1407 ToolkitTestApplication application;
1408 tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1412 TextLabel label = TextLabel::New();
1413 label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1414 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1415 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1419 //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1420 application.GetScene().Add( label );
1422 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1423 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1425 application.SendNotification();
1426 application.Render();
1428 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1429 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1431 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1432 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1434 application.SendNotification();
1435 application.Render();
1437 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1438 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1440 application.SendNotification();
1441 application.Render();
1443 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1444 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1446 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1447 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1449 application.SendNotification();
1450 application.Render();
1452 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1453 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1455 tet_infoline( "Ensure invalid string does not change wrapping mode" );
1456 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1457 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1462 int UtcDaliToolkitTextLabelColorComponents(void)
1464 ToolkitTestApplication application;
1466 TextLabel label = TextLabel::New();
1467 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1468 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 1.0f, TEST_LOCATION );
1469 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1470 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1471 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1473 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1474 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1475 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1476 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1477 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1479 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1480 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1481 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1482 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 1.0f, TEST_LOCATION );
1483 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1485 label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1486 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1487 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1489 // Test a transparent text - Rendering should be skipped.
1490 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1491 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1493 application.GetScene().Add( label );
1495 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1496 drawTrace.Enable( true );
1498 application.SendNotification();
1499 application.Render();
1501 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered
1503 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1507 application.SendNotification();
1508 application.Render();
1510 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1512 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1516 application.SendNotification();
1517 application.Render();
1519 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1524 int UtcDaliToolkitTextlabelTextStyle01(void)
1526 ToolkitTestApplication application;
1527 tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1529 TextLabel label = TextLabel::New();
1530 label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1531 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1532 label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1533 application.GetScene().Add( label );
1535 Property::Map outlineMapSet;
1536 Property::Map outlineMapGet;
1538 outlineMapSet["color"] = Color::BLUE;
1539 outlineMapSet["width"] = 2.0f;
1540 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1542 application.SendNotification();
1543 application.Render();
1545 Property::Map shadowMapSet;
1546 shadowMapSet.Insert( "color", "green" );
1547 shadowMapSet.Insert( "offset", "2 2" );
1548 shadowMapSet.Insert( "blurRadius", "3" );
1549 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1551 outlineMapSet["color"] = Color::RED;
1552 outlineMapSet["width"] = 0.0f;
1553 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1555 application.SendNotification();
1556 application.Render();
1558 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1560 Property::Value* colorValue = outlineMapGet.Find("color");
1562 bool colorMatched( false );
1566 Property::Type valueType = colorValue->GetType();
1568 if ( Property::STRING == valueType )
1570 std::string stringValue;
1571 colorValue->Get( stringValue );
1572 if ( stringValue == "red" )
1574 colorMatched = true;
1577 else if ( Property::VECTOR4 == valueType )
1579 Vector4 colorVector4;
1580 colorValue->Get( colorVector4 );
1581 if ( colorVector4 == Color::RED )
1583 colorMatched = true;
1588 DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1593 int UtcDaliToolkitTextlabelMultiline(void)
1595 ToolkitTestApplication application;
1596 tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1598 TextLabel label = TextLabel::New();
1599 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1600 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1601 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1602 application.GetScene().Add( label );
1604 application.SendNotification();
1605 application.Render();
1607 int lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1608 DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1610 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1612 application.SendNotification();
1613 application.Render();
1615 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1616 DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1622 int UtcDaliToolkitTextlabelTextDirection(void)
1624 ToolkitTestApplication application;
1625 tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1627 TextLabel label = TextLabel::New();
1628 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1630 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1631 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1632 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
1633 application.GetScene().Add( label );
1636 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1639 label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1640 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1642 // Test RTL text starting with weak character
1643 label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1644 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1646 // Test RTL text string with emoji and weak character
1647 label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1648 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1653 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1655 ToolkitTestApplication application;
1656 tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1658 TextLabel label = TextLabel::New();
1660 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP );
1661 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1662 label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1663 label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1664 application.GetScene().Add( label );
1665 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1667 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE );
1668 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1670 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM );
1671 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1676 int UtcDaliToolkitTextLabelBitmapFont(void)
1678 ToolkitTestApplication application;
1679 tet_infoline(" UtcDaliToolkitTextLabelBitmapFont");
1681 DevelText::BitmapFontDescription fontDescription;
1682 fontDescription.name = "Digits";
1683 fontDescription.underlinePosition = 0.f;
1684 fontDescription.underlineThickness = 0.f;
1686 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 34.f, 0.f } );
1687 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f } );
1688 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f } );
1689 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0033.png", "2", 34.f, 0.f } );
1690 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0034.png", "3", 34.f, 0.f } );
1691 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0035.png", "4", 34.f, 0.f } );
1692 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0036.png", "5", 34.f, 0.f } );
1693 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0037.png", "6", 34.f, 0.f } );
1694 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0038.png", "7", 34.f, 0.f } );
1695 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0039.png", "8", 34.f, 0.f } );
1696 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u003a.png", "9", 34.f, 0.f } );
1698 TextAbstraction::BitmapFont bitmapFont;
1699 DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1701 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1702 fontClient.GetFontId( bitmapFont );
1704 TextLabel label = TextLabel::New();
1706 label.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
1707 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1709 // 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.
1710 DALI_TEST_EQUALS( label.GetNaturalSize(), Vector3(322.f, 34.f, 0.f), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1712 application.GetScene().Add( label );
1714 application.SendNotification();
1715 application.Render();
1717 // The text has been rendered if the height of the text-label is the height of the line.
1718 DALI_TEST_EQUALS( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1723 int ConvertPointToPixel( float point )
1725 unsigned int horizontalDpi = 0u;
1726 unsigned int verticalDpi = 0u;
1727 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1728 fontClient.GetDpi( horizontalDpi, verticalDpi );
1730 return ( point * 72.f ) / static_cast< float >( horizontalDpi );
1733 int UtcDaliToolkitTextlabelTextFit(void)
1735 ToolkitTestApplication application;
1736 tet_infoline(" UtcDaliToolkitTextlabelTextFit");
1737 TextLabel label = TextLabel::New();
1738 Vector2 size( 460.0f, 100.0f );
1739 label.SetProperty( Actor::Property::SIZE, size );
1740 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1742 // connect to the text git changed signal.
1743 ConnectionTracker* testTracker = new ConnectionTracker();
1744 DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback);
1745 bool textFitChangedSignal = false;
1746 label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal));
1747 gTextFitChangedCallBackCalled = false;
1750 Property::Map textFitMapSet;
1751 textFitMapSet["enable"] = true;
1752 textFitMapSet["minSize"] = 10.f;
1753 textFitMapSet["maxSize"] = 100.f;
1754 textFitMapSet["stepSize"] = -1.f;
1755 textFitMapSet["fontSizeType"] = "pointSize";
1757 label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1758 label.SetProperty( TextLabel::Property::POINT_SIZE, 120.f);
1760 application.GetScene().Add( label );
1762 application.SendNotification();
1763 application.Render();
1765 const Vector3 EXPECTED_NATURAL_SIZE( 450.0f, 96.0f, 0.0f );
1766 DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1768 DALI_TEST_CHECK(gTextFitChangedCallBackCalled);
1769 DALI_TEST_CHECK(textFitChangedSignal);
1772 textFitMapSet.Clear();
1773 textFitMapSet["enable"] = true;
1774 textFitMapSet["minSize"] = ConvertPointToPixel( 10.f );
1775 textFitMapSet["maxSize"] = ConvertPointToPixel( 100.f );
1776 textFitMapSet["stepSize"] = ConvertPointToPixel ( 1.f );
1777 textFitMapSet["fontSizeType"] = "pixelSize";
1779 label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1781 application.SendNotification();
1782 application.Render();
1784 DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1789 int UtcDaliToolkitTextlabelMaxTextureSet(void)
1791 ToolkitTestApplication application;
1792 tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
1794 DevelText::BitmapFontDescription fontDescription;
1795 fontDescription.name = "Digits";
1796 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } );
1798 TextAbstraction::BitmapFont bitmapFont;
1799 DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1801 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1802 fontClient.GetFontId( bitmapFont );
1804 TextLabel label = TextLabel::New();
1805 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1806 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
1807 label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." );
1808 label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f );
1809 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1811 Property::Map underlineMapSet;
1812 underlineMapSet.Clear();
1813 underlineMapSet.Insert( "enable", true );
1814 underlineMapSet.Insert( "color", Color::RED );
1815 underlineMapSet.Insert( "height", 1 );
1816 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
1817 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1819 Property::Map strikethroughMapSet;
1820 strikethroughMapSet.Clear();
1821 strikethroughMapSet.Insert( "enable", true );
1822 strikethroughMapSet.Insert( "color", Color::RED );
1823 strikethroughMapSet.Insert( "height", 2.0f );
1824 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1825 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1827 application.GetScene().Add( label );
1829 application.SendNotification();
1830 application.Render();
1832 const int maxTextureSize = Dali::GetMaxTextureSize();
1833 // Whether the rendered text is greater than maxTextureSize
1834 DALI_TEST_CHECK( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height > maxTextureSize );
1836 // Check if the number of renderers is greater than 1.
1837 DALI_TEST_CHECK( label.GetRendererCount() > 1u );
1842 int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
1844 ToolkitTestApplication application;
1845 tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
1847 TextLabel label = TextLabel::New();
1848 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1849 label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1851 //Exeeding BufferWidth
1852 label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
1853 label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
1854 label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
1856 application.GetScene().Add( label );
1857 application.SendNotification();
1858 application.Render();
1860 Property::Map strikethroughMapSet;
1861 strikethroughMapSet.Clear();
1862 strikethroughMapSet.Insert( "enable", true );
1863 strikethroughMapSet.Insert( "color", Color::BLUE);
1864 strikethroughMapSet.Insert( "height", 2.0f);
1865 label.SetProperty( TextLabel::Property::TEXT, "Test1" );
1866 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1867 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1868 application.GetScene().Add( label );
1869 application.SendNotification();
1870 application.Render();
1871 // Check if the number of renderers is 1.
1872 DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
1875 label = TextLabel::New();
1876 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1877 label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1879 //Exeeding BufferHeight
1880 label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
1881 label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
1882 label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
1884 application.GetScene().Add( label );
1885 application.SendNotification();
1886 application.Render();
1888 strikethroughMapSet.Clear();
1889 strikethroughMapSet.Insert( "enable", true );
1890 strikethroughMapSet.Insert( "color", Color::BLUE);
1891 strikethroughMapSet.Insert( "height", 2.0f);
1892 label.SetProperty( TextLabel::Property::TEXT, "Test2" );
1893 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1894 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1895 application.GetScene().Add( label );
1896 application.SendNotification();
1897 application.Render();
1898 // Check if the number of renderers is 1.
1899 DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
1904 int UtcDaliToolkitTextlabelLastCharacterIndex(void)
1906 ToolkitTestApplication application;
1907 tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
1909 Vector2 size( 300.0f, 100.0f );
1911 Dali::Toolkit::DevelText::RendererParameters textParameters;
1912 textParameters.text = "This is a sample text to get the last index.";
1913 textParameters.layout = "multiLine";
1914 textParameters.fontSize = 20.f;
1915 textParameters.textWidth = 300u;
1916 textParameters.textHeight = 100u;
1917 textParameters.ellipsisEnabled = true;
1918 Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex( textParameters );
1920 DALI_TEST_CHECK( !indexArray.Empty() );
1921 DALI_TEST_EQUALS( indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION );
1926 int UtcDaliToolkitTextlabelFontSizeScale(void)
1928 ToolkitTestApplication application;
1929 tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
1931 TextLabel label = TextLabel::New();
1932 label.SetProperty( TextLabel::Property::POINT_SIZE, 30.f );
1933 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1934 Vector3 nonScaledSize = label.GetNaturalSize();
1936 TextLabel labelScaled = TextLabel::New();
1937 labelScaled.SetProperty( TextLabel::Property::POINT_SIZE, 15.f );
1938 labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1939 labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1940 Vector3 scaledSize = labelScaled.GetNaturalSize();
1942 DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1944 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 30.f );
1945 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1946 nonScaledSize = label.GetNaturalSize();
1948 labelScaled.SetProperty( TextLabel::Property::PIXEL_SIZE, 15.f );
1949 labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1950 labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1951 scaledSize = labelScaled.GetNaturalSize();
1953 DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1958 // Positive test for the anchorClicked signal.
1959 int UtcDaliToolkitTextlabelAnchorClicked(void)
1961 ToolkitTestApplication application;
1962 tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
1963 TextLabel label = TextLabel::New();
1964 DALI_TEST_CHECK(label);
1966 application.GetScene().Add(label);
1968 // connect to the anchor clicked signal.
1969 ConnectionTracker* testTracker = new ConnectionTracker();
1970 DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
1971 bool anchorClickedSignal = false;
1972 label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1974 gAnchorClickedCallBackCalled = false;
1975 label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1976 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1977 label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1978 label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1979 label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1981 application.SendNotification();
1982 application.Render();
1984 // Create a tap event to touch the text label.
1985 TestGenerateTap(application, 5.0f, 25.0f, 100);
1986 application.SendNotification();
1987 application.Render();
1989 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1990 DALI_TEST_CHECK(anchorClickedSignal);
1993 gAnchorClickedCallBackCalled = false;
1994 anchorClickedSignal = false;
1995 label.SetProperty(TextLabel::Property::TEXT, "");
1996 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, false);
1998 application.SendNotification();
1999 application.Render();
2002 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2003 label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
2004 label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2005 label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2006 label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2008 application.SendNotification();
2009 application.Render();
2011 // Create a tap event to touch the text label.
2012 TestGenerateTap(application, 5.0f, 25.0f, 200);
2013 application.SendNotification();
2014 application.Render();
2016 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
2017 DALI_TEST_CHECK(anchorClickedSignal);
2020 gAnchorClickedCallBackNotCalled = true;
2021 // Tap the outside of anchor, callback should not be called.
2022 TestGenerateTap(application, 150.f, 100.f, 300);
2023 application.SendNotification();
2024 application.Render();
2026 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
2031 int UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize(void)
2033 ToolkitTestApplication application;
2034 tet_infoline(" UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize ");
2036 //TextLabel is not using Atlas but this is to unify font-size on text-controllers
2038 // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
2039 const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2040 const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2042 // Create a text editor
2043 TextLabel textLabel = TextLabel::New();
2044 //Set size to avoid automatic eliding
2045 textLabel.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
2046 //Set very large font-size using point-size
2047 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 1000);
2048 //Specify font-family
2049 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2050 //Set text to check if appear or not
2051 textLabel.SetProperty( TextLabel::Property::TEXT, "A");
2053 application.GetScene().Add( textLabel );
2055 application.SendNotification();
2056 application.Render();
2057 //Use GetNaturalSize to verify that size of block does not exceed Atlas size
2058 Vector3 naturalSize = textLabel.GetNaturalSize();
2060 DALI_TEST_GREATER( lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION );
2061 DALI_TEST_GREATER( lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION );
2066 int UtcDaliTextLabelHyphenWrapMode(void)
2068 ToolkitTestApplication application;
2069 tet_infoline(" UtcDaliTextLabelHyphenWrapMode ");
2072 TextLabel label = TextLabel::New();
2073 label.SetProperty( Actor::Property::SIZE, Vector2( 150.0f, 300.f ));
2074 label.SetProperty( TextLabel::Property::POINT_SIZE, 12.f );
2075 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
2076 application.GetScene().Add( label );
2077 application.SendNotification();
2078 application.Render();
2080 label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
2081 label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::HYPHENATION);
2082 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::HYPHENATION ), TEST_LOCATION );
2084 application.SendNotification();
2085 application.Render();
2087 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2093 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
2095 label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
2096 label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::MIXED);
2097 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::MIXED ), TEST_LOCATION );
2099 application.SendNotification();
2100 application.Render();
2102 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2109 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
2114 int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
2116 ToolkitTestApplication application;
2118 tet_infoline(" utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged ");
2120 int lineCountBefore =0 ;
2121 int lineCountAfter =0 ;
2123 // Create a text editor
2124 TextLabel textLabel = TextLabel::New();
2125 //Set very large font-size using point-size
2126 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
2127 //Specify font-family
2128 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2130 textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 100.f ) );
2131 //Set text longer than width of textLabel
2132 textLabel.SetProperty( TextLabel::Property::TEXT, "Short text");
2133 //Set line wrap mode Character
2134 textLabel.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
2135 textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
2137 application.GetScene().Add( textLabel );
2139 application.SendNotification();
2140 application.Render();
2143 lineCountBefore = textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2145 textLabel.SetProperty( TextLabel::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
2146 lineCountAfter = textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2148 // When the text changed, the Line-count should be updated according to new text.
2149 // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
2150 DALI_TEST_EQUALS( lineCountBefore ,1, TEST_LOCATION );
2151 DALI_TEST_GREATER( lineCountAfter,1, TEST_LOCATION );
2157 int utcDaliTextLabelGeometryRTL(void)
2159 ToolkitTestApplication application;
2160 tet_infoline(" utcDaliTextLabelGeometryRTL");
2162 TextLabel label = TextLabel::New();
2163 DALI_TEST_CHECK( label );
2165 application.GetScene().Add( label );
2167 label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2168 label.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 100.f ) );
2169 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2170 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2171 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2172 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
2173 label.SetProperty( TextLabel::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر" );
2175 // Avoid a crash when core load gl resources.
2176 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2178 // Render and notify
2179 application.SendNotification();
2180 application.Render();
2182 unsigned int expectedCount = 4;
2183 unsigned int startIndex = 3;
2184 unsigned int endIndex = 24;
2186 Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2187 Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2189 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2190 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2192 Vector<Vector2> expectedSizes;
2193 Vector<Vector2> expectedPositions;
2195 expectedPositions.PushBack(Vector2(24, 0));
2196 expectedSizes.PushBack(Vector2(33, 25));
2198 expectedPositions.PushBack(Vector2(-1, 25));
2199 expectedSizes.PushBack(Vector2(52, 25));
2201 expectedPositions.PushBack(Vector2(-1, 50));
2202 expectedSizes.PushBack(Vector2(59, 25));
2204 expectedPositions.PushBack(Vector2(73, 75));
2205 expectedSizes.PushBack(Vector2(37, 25));
2207 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2212 int utcDaliTextLabelGeometryGlyphMiddle(void)
2214 ToolkitTestApplication application;
2215 tet_infoline(" utcDaliTextLabelGeometryGlyphMiddle");
2217 TextLabel label = TextLabel::New();
2218 DALI_TEST_CHECK( label );
2220 application.GetScene().Add( label );
2222 label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2223 label.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
2224 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2225 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2226 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2227 label.SetProperty( TextLabel::Property::TEXT, "لا تحتوي على لا" );
2229 // Avoid a crash when core load gl resources.
2230 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2232 // Render and notify
2233 application.SendNotification();
2234 application.Render();
2236 unsigned int expectedCount = 1;
2237 unsigned int startIndex = 1;
2238 unsigned int endIndex = 13;
2240 Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2241 Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2243 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2244 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2246 Vector<Vector2> expectedSizes;
2247 Vector<Vector2> expectedPositions;
2249 expectedPositions.PushBack(Vector2(12, 0));
2250 expectedSizes.PushBack(Vector2(118, 25));
2252 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2257 int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
2259 ToolkitTestApplication application;
2260 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
2261 TextLabel textLabel = TextLabel::New();
2263 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
2264 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2266 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
2267 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
2268 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2270 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
2271 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
2272 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2274 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
2275 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
2276 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2278 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
2279 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
2280 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2282 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
2283 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
2284 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2286 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
2287 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
2288 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2290 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
2291 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
2292 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2294 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
2295 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
2296 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2298 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
2299 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
2300 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2302 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
2303 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
2304 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2306 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
2307 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
2308 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2310 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
2311 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
2312 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2318 int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
2320 ToolkitTestApplication application;
2321 tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
2323 TextLabel textLabel = TextLabel::New();
2324 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
2325 textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
2326 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
2327 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2329 application.GetScene().Add( textLabel );
2330 application.SendNotification();
2331 application.Render();
2333 Property::Map strikethroughMapSet;
2334 Property::Map strikethroughMapGet;
2336 strikethroughMapSet.Insert( "enable", true );
2337 strikethroughMapSet.Insert( "color", Color::RED );
2338 strikethroughMapSet.Insert( "height", 2.0f );
2340 // Check the strikethrough property
2341 textLabel.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
2342 strikethroughMapGet = textLabel.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
2343 textLabel.SetProperty( TextLabel::Property::TEXT, "Test1" );
2344 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
2345 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
2347 // Render and notify
2348 application.SendNotification();
2349 application.Render();
2351 strikethroughMapSet.Clear();
2352 strikethroughMapGet.Clear();