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";
78 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
80 const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
82 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
83 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
85 static bool gAnchorClickedCallBackCalled;
86 static bool gAnchorClickedCallBackNotCalled;
88 static bool gTextFitChangedCallBackCalled;
90 struct CallbackFunctor
92 CallbackFunctor(bool* callbackFlag)
93 : mCallbackFlag( callbackFlag )
99 *mCallbackFlag = true;
104 static void TestAnchorClickedCallback(TextLabel control, const char* href, unsigned int hrefLength)
106 tet_infoline(" TestAnchorClickedCallback");
108 gAnchorClickedCallBackNotCalled = false;
110 if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
112 gAnchorClickedCallBackCalled = true;
116 static void TestTextFitChangedCallback(TextLabel control)
118 tet_infoline(" TestTextFitChangedCallback");
119 gTextFitChangedCallBackCalled = true;
122 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
124 const Property::Map::SizeType size = mapGet.Count();
126 if( size == mapSet.Count() )
128 for( unsigned int index = 0u; index < size; ++index )
130 const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
132 // Find the keys of the 'get' map
133 Property::Index indexKey = valueGet.first.indexKey;
134 std::string stringKey = valueGet.first.stringKey;
136 if( !indexConversionTable.empty() )
138 if( stringKey.empty() )
140 stringKey = indexConversionTable[ indexKey ];
143 if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
145 Property::Index index = 0u;
146 for( auto key : indexConversionTable )
148 if( key == stringKey )
158 const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
160 if( nullptr != valueSet )
162 if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
164 tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
167 else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
169 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
172 else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
174 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
177 else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
179 tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
182 else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
184 Vector2 vector2Get = valueGet.second.Get<Vector2>();
185 Vector2 vector2Set = valueSet->Get<Vector2>();
186 tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
189 else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
191 Vector4 vector4Get = valueGet.second.Get<Vector4>();
192 Vector4 vector4Set = valueSet->Get<Vector4>();
193 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 );
199 if ( valueGet.first.type == Property::Key::INDEX )
201 tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
205 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
217 int UtcDaliToolkitTextLabelConstructorP(void)
219 ToolkitTestApplication application;
220 tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
222 DALI_TEST_CHECK( !textLabel );
226 int UtcDaliToolkitTextLabelNewP(void)
228 ToolkitTestApplication application;
229 tet_infoline(" UtcDaliToolkitTextLabelNewP");
230 TextLabel textLabel = TextLabel::New( "Test Text" );
231 DALI_TEST_CHECK( textLabel );
235 int UtcDaliToolkitTextLabelDownCastP(void)
237 ToolkitTestApplication application;
238 tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
239 TextLabel textLabel1 = TextLabel::New();
240 BaseHandle object( textLabel1 );
242 TextLabel textLabel2 = TextLabel::DownCast( object );
243 DALI_TEST_CHECK( textLabel2 );
245 TextLabel textLabel3 = DownCast< TextLabel >( object );
246 DALI_TEST_CHECK( textLabel3 );
250 int UtcDaliToolkitTextLabelDownCastN(void)
252 ToolkitTestApplication application;
253 tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
254 BaseHandle uninitializedObject;
255 TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
256 DALI_TEST_CHECK( !textLabel1 );
258 TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
259 DALI_TEST_CHECK( !textLabel2 );
263 int UtcDaliToolkitTextLabelCopyConstructorP(void)
265 ToolkitTestApplication application;
266 tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
267 TextLabel textLabel = TextLabel::New();
268 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
270 TextLabel copy( textLabel );
271 DALI_TEST_CHECK( copy );
272 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
276 int UtcDaliTextLabelMoveConstructor(void)
278 ToolkitTestApplication application;
280 TextLabel textLabel = TextLabel::New();
281 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
282 DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
284 TextLabel moved = std::move( textLabel );
285 DALI_TEST_CHECK( moved );
286 DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
287 DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
288 DALI_TEST_CHECK( !textLabel );
293 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
295 ToolkitTestApplication application;
296 tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
297 TextLabel textLabel = TextLabel::New();
298 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
300 TextLabel copy = textLabel;
301 DALI_TEST_CHECK( copy );
302 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
306 int UtcDaliTextLabelMoveAssignment(void)
308 ToolkitTestApplication application;
310 TextLabel textLabel = TextLabel::New();
311 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
312 DALI_TEST_CHECK( textLabel.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
315 moved = std::move( textLabel );
316 DALI_TEST_CHECK( moved );
317 DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
318 DALI_TEST_CHECK( moved.GetProperty<std::string>( TextLabel::Property::TEXT ) == "Test" );
319 DALI_TEST_CHECK( !textLabel );
324 // Positive test case for a method
325 int UtcDaliToolkitTextLabelGetPropertyP(void)
327 ToolkitTestApplication application;
328 tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
329 TextLabel label = TextLabel::New("Test Text");
330 DALI_TEST_CHECK( label );
332 // Check Property Indices are correct
333 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == DevelTextLabel::Property::RENDERING_BACKEND );
334 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
335 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
336 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
337 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
338 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
339 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
340 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
341 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
342 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
343 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
344 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
345 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
346 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
347 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
348 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
349 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
350 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
351 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
352 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
353 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
354 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
355 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
356 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
357 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
358 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
359 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH );
364 int UtcDaliToolkitTextLabelSetPropertyP(void)
366 ToolkitTestApplication application;
367 tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
368 TextLabel label = TextLabel::New();
369 DALI_TEST_CHECK( label );
371 application.GetScene().Add( label );
373 // Note - we can't check the defaults since the stylesheets are platform-specific
374 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
375 DALI_TEST_EQUALS( (DevelText::RenderingType)label.GetProperty<int>( DevelTextLabel::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION );
377 // Check that text can be correctly reset
378 label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
379 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
381 // Check font properties.
382 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
383 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
385 Property::Map fontStyleMapSet;
386 Property::Map fontStyleMapGet;
388 fontStyleMapSet.Insert( "weight", "bold" );
389 fontStyleMapSet.Insert( "width", "condensed" );
390 fontStyleMapSet.Insert( "slant", "italic" );
391 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
393 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
394 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
395 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
397 // Check the old font style format.
398 fontStyleMapSet.Clear();
399 fontStyleMapSet.Insert( "weight", "thin" );
400 fontStyleMapSet.Insert( "width", "expanded" );
401 fontStyleMapSet.Insert( "slant", "oblique" );
402 const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
404 label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
405 std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
406 DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
408 label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
409 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
411 label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 2.5f );
412 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
413 label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
415 label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
416 DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
417 label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
420 fontStyleMapSet.Clear();
421 fontStyleMapSet.Insert( "weight", "normal" );
422 fontStyleMapSet.Insert( "slant", "oblique" );
424 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
425 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
426 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
427 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
429 fontStyleMapSet.Clear();
430 fontStyleMapSet.Insert( "slant", "roman" );
432 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
433 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
434 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
436 // Replace 'roman' for 'normal'.
437 Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
438 if( NULL != slantValue )
440 if( "normal" == slantValue->Get<std::string>() )
442 fontStyleMapGet["slant"] = "roman";
445 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
447 fontStyleMapSet.Clear();
449 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
450 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
451 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
452 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
455 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
456 DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
458 // Check that the Alignment properties can be correctly set
459 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
460 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
461 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
462 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
464 // Check that text color can be properly set
465 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
466 DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
468 Property::Map strikethroughMapSet;
469 Property::Map strikethroughMapGet;
471 strikethroughMapSet.Insert( "enable", false );
472 strikethroughMapSet.Insert( "color", Color::BLUE );
473 strikethroughMapSet.Insert( "height", 2.0f );
475 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
477 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
478 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
479 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
481 Property::Map underlineMapSet;
482 Property::Map underlineMapGet;
484 underlineMapSet.Insert( "enable", false );
485 underlineMapSet.Insert( "color", Color::BLUE );
486 underlineMapSet.Insert( "height", 0 );
488 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
489 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
490 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
492 TextLabel label2 = TextLabel::New( "New text" );
493 DALI_TEST_CHECK( label2 );
494 DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
496 // Check the enable markup property.
497 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
498 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
499 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
501 // Check the text property when markup is enabled
502 label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
503 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
505 // Check for incomplete marks.
506 label.SetProperty( TextLabel::Property::TEXT, "<color='white'><i>Markup</i><b>Text</b></color>" );
507 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
510 application.SendNotification();
511 application.Render();
515 tet_result(TET_FAIL);
518 // Check autoscroll properties
519 const int SCROLL_SPEED = 80;
520 const int SCROLL_LOOPS = 4;
521 const float SCROLL_GAP = 50.0f;
522 const float SCROLL_LOOP_DELAY = 0.3f;
523 const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
524 const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
526 label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
527 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
528 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
529 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
530 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
531 DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
532 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
533 DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
534 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
535 DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
536 label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
537 DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
539 //Check autoscroll stop type property
540 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
541 DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
543 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
544 DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
546 // test natural size with multi-line and line spacing
548 TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
549 Vector3 oneLineNaturalSize = label3.GetNaturalSize();
550 label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
551 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
552 Vector3 multiLineNaturalSize = label3.GetNaturalSize();
554 // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
555 // The height of the text when multi-line is enabled will be larger
556 DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
557 DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
559 // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
560 // Everything else will remain the same
561 int lineSpacing = 20;
562 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
563 Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
564 expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
565 DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
568 // single line, line spacing must not affect natural size of the text, only add the spacing to the height
570 TextLabel label3 = TextLabel::New("Some text here end there end here");
571 label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
572 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
573 Vector3 textNaturalSize = label3.GetNaturalSize();
574 int lineSpacing = 20;
575 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
576 Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
577 expectedNaturalSizeWithLineSpacing.height += lineSpacing;
578 DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
580 // Check the line spacing property
581 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
582 label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
583 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
585 // Check the strikethrough property
586 strikethroughMapSet.Clear();
587 strikethroughMapSet.Insert( "enable", true );
588 strikethroughMapSet.Insert( "color", Color::RED );
589 strikethroughMapSet.Insert( "height", 2.0f );
591 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
593 application.SendNotification();
594 application.Render();
596 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
597 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
598 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
600 strikethroughMapSet.Clear();
601 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::ENABLE, true );
602 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED );
603 strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f );
605 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
607 application.SendNotification();
608 application.Render();
610 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
611 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
612 std::vector<std::string> strikethroughIndicesConversionTable = { "enable", "color","height"};
613 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable ), true, TEST_LOCATION );
615 strikethroughMapSet.Clear();
617 Property::Map strikethroughDisabledMapGet;
618 strikethroughDisabledMapGet.Insert( "enable", false );
619 strikethroughDisabledMapGet.Insert( "color", Color::RED );
620 strikethroughDisabledMapGet.Insert( "height", 2.0f );
622 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
624 application.SendNotification();
625 application.Render();
627 strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
628 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION );
629 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughDisabledMapGet ), true, TEST_LOCATION );
631 // Check the underline property
632 underlineMapSet.Clear();
633 underlineMapSet.Insert( "enable", true );
634 underlineMapSet.Insert( "color", Color::RED );
635 underlineMapSet.Insert( "height", 1 );
637 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
639 application.SendNotification();
640 application.Render();
642 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
643 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
644 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
646 underlineMapSet.Clear();
647 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true );
648 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN );
649 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 );
651 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
653 application.SendNotification();
654 application.Render();
656 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
657 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
658 std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
659 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
661 underlineMapSet.Clear();
663 Property::Map underlineDisabledMapGet;
664 underlineDisabledMapGet.Insert( "enable", false );
665 underlineDisabledMapGet.Insert( "color", Color::GREEN );
666 underlineDisabledMapGet.Insert( "height", 2 );
668 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
670 application.SendNotification();
671 application.Render();
673 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
674 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
675 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
677 // Check the shadow property
679 Property::Map shadowMapSet;
680 Property::Map shadowMapGet;
682 shadowMapSet.Insert( "color", Color::GREEN );
683 shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
684 shadowMapSet.Insert( "blurRadius", 5.0f );
686 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
688 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
689 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
690 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
692 shadowMapSet.Clear();
694 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
695 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
696 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
698 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
700 // Replace the offset (string) by a vector2
701 shadowMapSet.Clear();
702 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
703 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
704 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
706 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
707 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
708 std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
709 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
711 shadowMapSet.Clear();
712 Property::Map shadowDisabledMapGet;
713 shadowDisabledMapGet.Insert( "color", Color::BLUE );
714 shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
715 shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
717 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
719 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
720 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
721 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
723 // Check the emboss property
724 label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
725 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
727 // Check the outline property
729 // Test string type first
730 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
731 label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
732 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
734 // Then test the property map type
735 Property::Map outlineMapSet;
736 Property::Map outlineMapGet;
738 outlineMapSet["color"] = Color::RED;
739 outlineMapSet["width"] = 2.0f;
740 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
742 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
743 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
744 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
746 outlineMapSet.Clear();
747 outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
748 outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
749 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
751 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
752 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
753 std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
754 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
756 // Check the background property
757 Property::Map backgroundMapSet;
758 Property::Map backgroundMapGet;
760 backgroundMapSet["enable"] = true;
761 backgroundMapSet["color"] = Color::RED;
762 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
764 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
765 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
766 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
768 backgroundMapSet.Clear();
769 backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
770 backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
771 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
773 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
774 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
775 std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
776 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
778 // Check the pixel size of font
779 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
780 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
782 // Check the ellipsis property
783 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
784 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
785 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
787 // Check the layout direction property
788 label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
789 DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
791 // Check the line size property
792 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
793 label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f );
794 DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
796 application.SendNotification();
797 application.Render();
802 int UtcDaliToolkitTextlabelAtlasRenderP(void)
804 ToolkitTestApplication application;
805 tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
806 TextLabel label = TextLabel::New("Test Text");
807 DALI_TEST_CHECK( label );
809 // Avoid a crash when core load gl resources.
810 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
812 application.GetScene().Add( label );
814 // Turn on all the effects
815 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
816 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
818 Property::Map underlineMap;
819 underlineMap.Insert( "enable", true );
820 underlineMap.Insert( "color", Color::RED );
821 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
823 Property::Map shadowMap;
824 shadowMap.Insert( "color", Color::BLUE );
825 shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
826 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
828 Property::Map strikethroughMap;
829 strikethroughMap.Insert( "enable", true );
830 strikethroughMap.Insert( "color", Color::GREEN );
831 strikethroughMap.Insert( "height", 2.0f );
832 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap );
836 // Render some text with the shared atlas backend
837 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
838 application.SendNotification();
839 application.Render();
843 tet_result(TET_FAIL);
848 // Render some text with the shared atlas backend
849 label.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED );
850 application.SendNotification();
851 application.Render();
855 tet_result(TET_FAIL);
860 int UtcDaliToolkitTextLabelLanguagesP(void)
862 ToolkitTestApplication application;
863 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
864 TextLabel label = TextLabel::New();
865 DALI_TEST_CHECK( label );
867 application.GetScene().Add( label );
869 const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
870 "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
871 "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
872 "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
873 "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
874 "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
876 label.SetProperty( TextLabel::Property::TEXT, scripts );
877 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
879 application.SendNotification();
880 application.Render();
885 int UtcDaliToolkitTextLabelEmojisP(void)
887 ToolkitTestApplication application;
888 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
889 TextLabel label = TextLabel::New();
890 DALI_TEST_CHECK( label );
892 application.GetScene().Add( label );
894 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
896 char* pathNamePtr = get_current_dir_name();
897 const std::string pathName( pathNamePtr );
900 TextAbstraction::FontDescription fontDescription;
901 fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
902 fontDescription.family = "BreezeColorEmoji";
903 fontDescription.width = TextAbstraction::FontWidth::NONE;
904 fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
905 fontDescription.slant = TextAbstraction::FontSlant::NONE;
907 fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
909 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>";
910 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
911 label.SetProperty( TextLabel::Property::TEXT, emojis );
913 Property::Map shadowMap;
914 shadowMap.Insert( "color", "green" );
915 shadowMap.Insert( "offset", "2 2" );
916 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
918 application.SendNotification();
919 application.Render();
921 // EMOJI + ZWJ + EMOJI case for coverage.
922 const std::string emojiWithZWJ = "👩‍🔬";
923 label.SetProperty( TextLabel::Property::TEXT, emojiWithZWJ );
925 application.SendNotification();
926 application.Render();
928 // EMOJI Sequences case for coverage.
929 std::string emojiSequences =
930 "Text VS15 ☪︎\n" //text presentation sequence and selector
931 "Color VS16 ☪️\n" //emoji presentation sequence and selector
932 "Default ☪ \n" //default presentation
933 "FamilyManWomanGirlBoy 👨‍👩‍👧‍👦\n" // emoji multi zwj sequence
934 "WomanScientist 👩‍🔬\n" // emoji zwj sequence
935 "WomanScientistLightSkinTone👩🏻‍🔬 \n" //emoji modifier sequence: skin tone & JWZ
936 "LeftRightArrowText↔︎\n" //text presentation sequence and selector
937 "LeftRightArrowEmoji↔️\n" //emoji presentation sequence and selector
938 "SouthKoreaFlag🇰🇷\n" //emoji flag sequence
939 "JordanFlag🇯🇴\n" // emoji flag sequence
940 "EnglandFlag🏴󠁧󠁢󠁥󠁮󠁧󠁿\n" //emoji tag sequence like England flag
941 "Runner 🏃‍➡️ \n"
942 "VictoryHandMediumLightSkinTone:✌️🏼\n" //emoji modifier sequence: skin tone
943 "RainbowFlag:🏳️‍🌈 \n" //emoji zwj sequence: Rainbow Flag
944 "keycap# #️⃣ \n" // fully-qualified emoji keycap sequence
945 "keycap#_text #⃣ \n" // unqualified emoji keycap sequence
946 "keycap3 3️⃣ \n" // fully-qualified emoji keycap sequence
947 "keycap3_text 3⃣ \n" // unqualified emoji keycap sequence
948 "two adjacent glyphs ☪️️️☪️\n" //This line should be rendered as two adjacent glyphs
949 "Digit 8️ 8︎ 8\n" // should be rendered according to selector
950 "Surfing Medium Skin Female: 🏄🏼‍♀️"; // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
952 label.SetProperty( TextLabel::Property::TEXT, emojiSequences );
953 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
954 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
955 label.SetProperty( TextLabel::Property::ELLIPSIS, false);
957 application.SendNotification();
958 application.Render();
962 int UtcDaliToolkitTextlabelScrollingP(void)
964 ToolkitTestApplication application;
965 tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
966 TextLabel labelImmediate = TextLabel::New("Some text to scroll");
967 TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
969 DALI_TEST_CHECK( labelImmediate );
970 DALI_TEST_CHECK( labelFinished );
971 // Avoid a crash when core load gl resources.
972 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
973 application.GetScene().Add( labelImmediate );
974 // Turn on all the effects
975 labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
976 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
977 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
978 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
979 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
981 application.GetScene().Add( labelFinished );
982 // Turn on all the effects
983 labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
984 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
985 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
986 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
987 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
993 // Render some text with the shared atlas backend
994 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
995 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
997 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
998 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1000 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1001 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1002 application.SendNotification();
1003 application.Render();
1005 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1006 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1007 application.SendNotification();
1008 application.Render();
1013 tet_result(TET_FAIL);
1019 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
1021 ToolkitTestApplication application;
1022 TextLabel labelShort = TextLabel::New("Some text to scroll");
1023 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!");
1025 DALI_TEST_CHECK( labelShort );
1026 DALI_TEST_CHECK( labelLong );
1027 // Avoid a crash when core load gl resources.
1028 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1029 application.GetScene().Add( labelShort );
1030 // Turn on all the effects
1031 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1032 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1033 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1034 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1035 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1036 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1038 application.GetScene().Add( labelLong );
1039 // Turn on all the effects
1040 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1041 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1042 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1043 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1044 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1045 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1049 // Render some text with the shared atlas backend
1050 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1051 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1052 application.SendNotification();
1053 application.Render();
1055 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1056 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1057 application.SendNotification();
1058 application.Render();
1063 tet_result(TET_FAIL);
1069 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
1071 ToolkitTestApplication application;
1072 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1073 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1075 DALI_TEST_CHECK( labelShort );
1076 DALI_TEST_CHECK( labelLong );
1077 // Avoid a crash when core load gl resources.
1078 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1079 application.GetScene().Add( labelShort );
1080 // Turn on all the effects
1081 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1082 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1083 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1084 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1085 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1086 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1088 application.GetScene().Add( labelLong );
1089 // Turn on all the effects
1090 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1091 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
1092 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1093 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1094 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1095 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1099 // Render some text with the shared atlas backend
1100 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1101 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1102 application.SendNotification();
1103 application.Render();
1105 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1106 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1107 application.SendNotification();
1108 application.Render();
1113 tet_result(TET_FAIL);
1119 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
1121 ToolkitTestApplication application;
1122 TextLabel labelShort = TextLabel::New("Some text to scroll");
1123 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!");
1125 DALI_TEST_CHECK( labelShort );
1126 DALI_TEST_CHECK( labelLong );
1127 // Avoid a crash when core load gl resources.
1128 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1129 application.GetScene().Add( labelShort );
1130 // Turn on all the effects
1131 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1132 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1133 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1134 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1135 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1136 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1138 application.GetScene().Add( labelLong );
1139 // Turn on all the effects
1140 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1141 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1142 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1143 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1144 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1145 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1149 // Render some text with the shared atlas backend
1150 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1151 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1152 application.SendNotification();
1153 application.Render();
1155 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1156 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1157 application.SendNotification();
1158 application.Render();
1163 tet_result(TET_FAIL);
1169 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
1171 ToolkitTestApplication application;
1172 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
1173 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
1175 DALI_TEST_CHECK( labelShort );
1176 DALI_TEST_CHECK( labelLong );
1177 // Avoid a crash when core load gl resources.
1178 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1179 application.GetScene().Add( labelShort );
1180 // Turn on all the effects
1181 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
1182 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1183 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1184 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1185 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1186 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1188 application.GetScene().Add( labelLong );
1189 // Turn on all the effects
1190 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
1191 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
1192 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1193 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1194 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1195 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
1199 // Render some text with the shared atlas backend
1200 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1201 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1202 application.SendNotification();
1203 application.Render();
1205 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1206 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1207 application.SendNotification();
1208 application.Render();
1213 tet_result(TET_FAIL);
1219 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1221 ToolkitTestApplication application;
1222 tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1223 TextLabel label = TextLabel::New("Some text to scroll");
1224 DALI_TEST_CHECK( label );
1225 // Avoid a crash when core load gl resources.
1226 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1227 application.GetScene().Add( label );
1228 label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 20.f ) );
1229 // Turn on all the effects
1230 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1231 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1232 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1233 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1236 application.SendNotification();
1237 application.Render();
1239 unsigned int actorCount1 = label.GetChildCount();
1240 tet_printf("Initial actor count is(%d)\n", actorCount1 );
1244 // Render some text with the shared atlas backend
1245 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1246 application.SendNotification();
1247 application.Render(2000);
1249 unsigned int actorCount1 = label.GetChildCount();
1250 tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1252 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1255 application.SendNotification();
1256 application.Render();
1258 unsigned int actorCount2 = label.GetChildCount();
1259 tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1261 DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1266 tet_result(TET_FAIL);
1272 int UtcDaliToolkitTextlabelScrollingN(void)
1274 ToolkitTestApplication application;
1275 tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1277 TextLabel label = TextLabel::New("Some text to scroll");
1278 DALI_TEST_CHECK( label );
1280 application.GetScene().Add( label );
1282 // Avoid a crash when core load gl resources.
1283 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1285 // The text scrolling works only on single line text.
1286 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1288 // Turn on all the effects.
1289 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1290 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1291 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1293 // Enable the auto scrolling effect.
1294 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1296 // The auto scrolling shouldn't be enabled.
1297 const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1298 DALI_TEST_CHECK( !enabled );
1303 int UtcDaliToolkitTextlabelScrollingWithEllipsis(void)
1305 ToolkitTestApplication application;
1306 tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis");
1308 TextLabel label = TextLabel::New("Some text to scroll");
1309 DALI_TEST_CHECK( label );
1311 application.GetScene().Add( label );
1313 // Avoid a crash when core load gl resources.
1314 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1316 // Turn on all the effects.
1317 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1318 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1319 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1323 // Enable the auto scrolling effect.
1324 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1325 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
1327 // Disable the ellipsis
1328 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
1331 application.SendNotification();
1332 application.Render();
1334 // Stop auto scrolling
1335 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
1337 // Check the ellipsis property
1338 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
1342 tet_result(TET_FAIL);
1348 int UtcDaliToolkitTextlabelEllipsis(void)
1350 ToolkitTestApplication application;
1351 tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1353 TextLabel label = TextLabel::New("Hello world");
1354 DALI_TEST_CHECK( label );
1356 // Avoid a crash when core load gl resources.
1357 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1359 application.GetScene().Add( label );
1361 // Turn on all the effects
1362 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1363 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1364 label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 10.f ) );
1369 application.SendNotification();
1370 application.Render();
1374 tet_result(TET_FAIL);
1377 label.SetProperty( TextLabel::Property::TEXT, "Hello world " );
1378 label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1379 label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1384 application.SendNotification();
1385 application.Render();
1389 tet_result(TET_FAIL);
1393 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1394 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1395 label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) );
1400 application.SendNotification();
1401 application.Render();
1405 tet_result(TET_FAIL);
1411 int UtcDaliToolkitTextlabelTextWrapMode(void)
1413 ToolkitTestApplication application;
1414 tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1418 TextLabel label = TextLabel::New();
1419 label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1420 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1421 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1425 //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1426 application.GetScene().Add( label );
1428 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1429 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1431 application.SendNotification();
1432 application.Render();
1434 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1435 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1437 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1438 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1440 application.SendNotification();
1441 application.Render();
1443 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1444 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1446 application.SendNotification();
1447 application.Render();
1449 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1450 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1452 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1453 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1455 application.SendNotification();
1456 application.Render();
1458 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1459 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
1461 tet_infoline( "Ensure invalid string does not change wrapping mode" );
1462 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1463 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1468 int UtcDaliToolkitTextLabelColorComponents(void)
1470 ToolkitTestApplication application;
1472 TextLabel label = TextLabel::New();
1473 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1474 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 1.0f, TEST_LOCATION );
1475 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.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::GREEN );
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 ), 1.0f, TEST_LOCATION );
1482 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.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, Color::BLUE );
1486 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1487 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1488 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 1.0f, TEST_LOCATION );
1489 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1491 label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1492 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1493 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1495 // Test a transparent text - Rendering should be skipped.
1496 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1497 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1499 application.GetScene().Add( label );
1501 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1502 drawTrace.Enable( true );
1504 application.SendNotification();
1505 application.Render();
1507 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered
1509 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1513 application.SendNotification();
1514 application.Render();
1516 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1518 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1522 application.SendNotification();
1523 application.Render();
1525 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1530 int UtcDaliToolkitTextlabelTextStyle01(void)
1532 ToolkitTestApplication application;
1533 tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1535 TextLabel label = TextLabel::New();
1536 label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) );
1537 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1538 label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1539 application.GetScene().Add( label );
1541 Property::Map outlineMapSet;
1542 Property::Map outlineMapGet;
1544 outlineMapSet["color"] = Color::BLUE;
1545 outlineMapSet["width"] = 2.0f;
1546 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1548 application.SendNotification();
1549 application.Render();
1551 Property::Map shadowMapSet;
1552 shadowMapSet.Insert( "color", "green" );
1553 shadowMapSet.Insert( "offset", "2 2" );
1554 shadowMapSet.Insert( "blurRadius", "3" );
1555 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1557 outlineMapSet["color"] = Color::RED;
1558 outlineMapSet["width"] = 0.0f;
1559 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1561 application.SendNotification();
1562 application.Render();
1564 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1566 Property::Value* colorValue = outlineMapGet.Find("color");
1568 bool colorMatched( false );
1572 Property::Type valueType = colorValue->GetType();
1574 if ( Property::STRING == valueType )
1576 std::string stringValue;
1577 colorValue->Get( stringValue );
1578 if ( stringValue == "red" )
1580 colorMatched = true;
1583 else if ( Property::VECTOR4 == valueType )
1585 Vector4 colorVector4;
1586 colorValue->Get( colorVector4 );
1587 if ( colorVector4 == Color::RED )
1589 colorMatched = true;
1594 DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1599 int UtcDaliToolkitTextlabelMultiline(void)
1601 ToolkitTestApplication application;
1602 tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1604 TextLabel label = TextLabel::New();
1605 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1606 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1607 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1608 application.GetScene().Add( label );
1610 application.SendNotification();
1611 application.Render();
1613 int lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1614 DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1616 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1618 application.SendNotification();
1619 application.Render();
1621 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1622 DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1628 int UtcDaliToolkitTextlabelTextDirection(void)
1630 ToolkitTestApplication application;
1631 tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1633 TextLabel label = TextLabel::New();
1634 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1636 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1637 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1638 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
1639 application.GetScene().Add( label );
1642 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1645 label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1646 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1648 // Test RTL text starting with weak character
1649 label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1650 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1652 // Test RTL text string with emoji and weak character
1653 label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1654 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1659 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1661 ToolkitTestApplication application;
1662 tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1664 TextLabel label = TextLabel::New();
1666 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP );
1667 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1668 label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1669 label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1670 application.GetScene().Add( label );
1671 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1673 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE );
1674 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1676 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM );
1677 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
1682 int UtcDaliToolkitTextLabelBitmapFont(void)
1684 ToolkitTestApplication application;
1685 tet_infoline(" UtcDaliToolkitTextLabelBitmapFont");
1687 DevelText::BitmapFontDescription fontDescription;
1688 fontDescription.name = "Digits";
1689 fontDescription.underlinePosition = 0.f;
1690 fontDescription.underlineThickness = 0.f;
1692 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 34.f, 0.f } );
1693 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f } );
1694 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f } );
1695 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0033.png", "2", 34.f, 0.f } );
1696 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0034.png", "3", 34.f, 0.f } );
1697 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0035.png", "4", 34.f, 0.f } );
1698 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0036.png", "5", 34.f, 0.f } );
1699 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0037.png", "6", 34.f, 0.f } );
1700 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0038.png", "7", 34.f, 0.f } );
1701 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0039.png", "8", 34.f, 0.f } );
1702 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u003a.png", "9", 34.f, 0.f } );
1704 TextAbstraction::BitmapFont bitmapFont;
1705 DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1707 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1708 fontClient.GetFontId( bitmapFont );
1710 TextLabel label = TextLabel::New();
1712 label.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
1713 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1715 // 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.
1716 DALI_TEST_EQUALS( label.GetNaturalSize(), Vector3(322.f, 34.f, 0.f), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1718 application.GetScene().Add( label );
1720 application.SendNotification();
1721 application.Render();
1723 // The text has been rendered if the height of the text-label is the height of the line.
1724 DALI_TEST_EQUALS( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1729 int ConvertPointToPixel( float point )
1731 unsigned int horizontalDpi = 0u;
1732 unsigned int verticalDpi = 0u;
1733 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1734 fontClient.GetDpi( horizontalDpi, verticalDpi );
1736 return ( point * 72.f ) / static_cast< float >( horizontalDpi );
1739 int UtcDaliToolkitTextlabelTextFit(void)
1741 ToolkitTestApplication application;
1742 tet_infoline(" UtcDaliToolkitTextlabelTextFit");
1743 TextLabel label = TextLabel::New();
1744 Vector2 size( 460.0f, 100.0f );
1745 label.SetProperty( Actor::Property::SIZE, size );
1746 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1748 // connect to the text git changed signal.
1749 ConnectionTracker* testTracker = new ConnectionTracker();
1750 DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback);
1751 bool textFitChangedSignal = false;
1752 label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal));
1753 gTextFitChangedCallBackCalled = false;
1756 Property::Map textFitMapSet;
1757 textFitMapSet["enable"] = true;
1758 textFitMapSet["minSize"] = 10.f;
1759 textFitMapSet["maxSize"] = 100.f;
1760 textFitMapSet["stepSize"] = -1.f;
1761 textFitMapSet["fontSizeType"] = "pointSize";
1763 label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1764 label.SetProperty( TextLabel::Property::POINT_SIZE, 120.f);
1766 application.GetScene().Add( label );
1768 application.SendNotification();
1769 application.Render();
1771 const Vector3 EXPECTED_NATURAL_SIZE( 450.0f, 96.0f, 0.0f );
1772 DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1774 DALI_TEST_CHECK(gTextFitChangedCallBackCalled);
1775 DALI_TEST_CHECK(textFitChangedSignal);
1778 textFitMapSet.Clear();
1779 textFitMapSet["enable"] = true;
1780 textFitMapSet["minSize"] = ConvertPointToPixel( 10.f );
1781 textFitMapSet["maxSize"] = ConvertPointToPixel( 100.f );
1782 textFitMapSet["stepSize"] = ConvertPointToPixel ( 1.f );
1783 textFitMapSet["fontSizeType"] = "pixelSize";
1785 label.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet );
1787 application.SendNotification();
1788 application.Render();
1790 DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION );
1795 int UtcDaliToolkitTextlabelMaxTextureSet(void)
1797 ToolkitTestApplication application;
1798 tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet");
1800 DevelText::BitmapFontDescription fontDescription;
1801 fontDescription.name = "Digits";
1802 fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } );
1804 TextAbstraction::BitmapFont bitmapFont;
1805 DevelText::CreateBitmapFont( fontDescription, bitmapFont );
1807 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1808 fontClient.GetFontId( bitmapFont );
1810 TextLabel label = TextLabel::New();
1811 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
1812 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
1813 label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." );
1814 label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f );
1815 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1817 Property::Map underlineMapSet;
1818 underlineMapSet.Clear();
1819 underlineMapSet.Insert( "enable", true );
1820 underlineMapSet.Insert( "color", Color::RED );
1821 underlineMapSet.Insert( "height", 1 );
1822 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
1823 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1825 Property::Map strikethroughMapSet;
1826 strikethroughMapSet.Clear();
1827 strikethroughMapSet.Insert( "enable", true );
1828 strikethroughMapSet.Insert( "color", Color::RED );
1829 strikethroughMapSet.Insert( "height", 2.0f );
1830 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1831 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1833 application.GetScene().Add( label );
1835 application.SendNotification();
1836 application.Render();
1838 const int maxTextureSize = Dali::GetMaxTextureSize();
1839 // Whether the rendered text is greater than maxTextureSize
1840 DALI_TEST_CHECK( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height > maxTextureSize );
1842 // Check if the number of renderers is greater than 1.
1843 DALI_TEST_CHECK( label.GetRendererCount() > 1u );
1848 int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
1850 ToolkitTestApplication application;
1851 tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
1853 TextLabel label = TextLabel::New();
1854 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1855 label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1857 //Exeeding BufferWidth
1858 label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
1859 label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
1860 label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
1862 application.GetScene().Add( label );
1863 application.SendNotification();
1864 application.Render();
1866 Property::Map strikethroughMapSet;
1867 strikethroughMapSet.Clear();
1868 strikethroughMapSet.Insert( "enable", true );
1869 strikethroughMapSet.Insert( "color", Color::BLUE);
1870 strikethroughMapSet.Insert( "height", 2.0f);
1871 label.SetProperty( TextLabel::Property::TEXT, "Test1" );
1872 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1873 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1874 application.GetScene().Add( label );
1875 application.SendNotification();
1876 application.Render();
1877 // Check if the number of renderers is 1.
1878 DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
1881 label = TextLabel::New();
1882 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1883 label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
1885 //Exeeding BufferHeight
1886 label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
1887 label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
1888 label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
1890 application.GetScene().Add( label );
1891 application.SendNotification();
1892 application.Render();
1894 strikethroughMapSet.Clear();
1895 strikethroughMapSet.Insert( "enable", true );
1896 strikethroughMapSet.Insert( "color", Color::BLUE);
1897 strikethroughMapSet.Insert( "height", 2.0f);
1898 label.SetProperty( TextLabel::Property::TEXT, "Test2" );
1899 label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
1900 label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
1901 application.GetScene().Add( label );
1902 application.SendNotification();
1903 application.Render();
1904 // Check if the number of renderers is 1.
1905 DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
1910 int UtcDaliToolkitTextlabelLastCharacterIndex(void)
1912 ToolkitTestApplication application;
1913 tet_infoline(" UtcDaliToolkitTextlabelLastCharacterIndex");
1915 Vector2 size( 300.0f, 100.0f );
1917 Dali::Toolkit::DevelText::RendererParameters textParameters;
1918 textParameters.text = "This is a sample text to get the last index.";
1919 textParameters.layout = "multiLine";
1920 textParameters.fontSize = 20.f;
1921 textParameters.textWidth = 300u;
1922 textParameters.textHeight = 100u;
1923 textParameters.ellipsisEnabled = true;
1924 Dali::Property::Array indexArray = Dali::Toolkit::DevelText::GetLastCharacterIndex( textParameters );
1926 DALI_TEST_CHECK( !indexArray.Empty() );
1927 DALI_TEST_EQUALS( indexArray.GetElementAt(0).Get<int>(), 10, TEST_LOCATION );
1932 int UtcDaliToolkitTextlabelFontSizeScale(void)
1934 ToolkitTestApplication application;
1935 tet_infoline(" UtcDaliToolkitTextlabelFontSizeScale");
1937 TextLabel label = TextLabel::New();
1938 label.SetProperty( TextLabel::Property::POINT_SIZE, 30.f );
1939 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1940 Vector3 nonScaledSize = label.GetNaturalSize();
1942 TextLabel labelScaled = TextLabel::New();
1943 labelScaled.SetProperty( TextLabel::Property::POINT_SIZE, 15.f );
1944 labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1945 labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1946 Vector3 scaledSize = labelScaled.GetNaturalSize();
1948 DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1950 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 30.f );
1951 label.SetProperty( TextLabel::Property::TEXT, "Test" );
1952 nonScaledSize = label.GetNaturalSize();
1954 labelScaled.SetProperty( TextLabel::Property::PIXEL_SIZE, 15.f );
1955 labelScaled.SetProperty( Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE, 2.f );
1956 labelScaled.SetProperty( TextLabel::Property::TEXT, "Test" );
1957 scaledSize = labelScaled.GetNaturalSize();
1959 DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION );
1964 // Positive test for the anchorClicked signal.
1965 int UtcDaliToolkitTextlabelAnchorClicked(void)
1967 ToolkitTestApplication application;
1968 tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
1969 TextLabel label = TextLabel::New();
1970 DALI_TEST_CHECK(label);
1972 application.GetScene().Add(label);
1974 // connect to the anchor clicked signal.
1975 ConnectionTracker* testTracker = new ConnectionTracker();
1976 DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
1977 bool anchorClickedSignal = false;
1978 label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1980 gAnchorClickedCallBackCalled = false;
1981 label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1982 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
1983 label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1984 label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1985 label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1987 application.SendNotification();
1988 application.Render();
1990 // Create a tap event to touch the text label.
1991 TestGenerateTap(application, 5.0f, 25.0f, 100);
1992 application.SendNotification();
1993 application.Render();
1995 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1996 DALI_TEST_CHECK(anchorClickedSignal);
1999 gAnchorClickedCallBackCalled = false;
2000 anchorClickedSignal = false;
2001 label.SetProperty(TextLabel::Property::TEXT, "");
2002 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, false);
2004 application.SendNotification();
2005 application.Render();
2008 label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
2009 label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
2010 label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2011 label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2012 label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2014 application.SendNotification();
2015 application.Render();
2017 // Create a tap event to touch the text label.
2018 TestGenerateTap(application, 5.0f, 25.0f, 200);
2019 application.SendNotification();
2020 application.Render();
2022 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
2023 DALI_TEST_CHECK(anchorClickedSignal);
2026 gAnchorClickedCallBackNotCalled = true;
2027 // Tap the outside of anchor, callback should not be called.
2028 TestGenerateTap(application, 150.f, 100.f, 300);
2029 application.SendNotification();
2030 application.Render();
2032 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
2037 int UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize(void)
2039 ToolkitTestApplication application;
2040 tet_infoline(" UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize ");
2042 //TextLabel is not using Atlas but this is to unify font-size on text-controllers
2044 // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
2045 const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2046 const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
2048 // Create a text editor
2049 TextLabel textLabel = TextLabel::New();
2050 //Set size to avoid automatic eliding
2051 textLabel.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
2052 //Set very large font-size using point-size
2053 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 1000);
2054 //Specify font-family
2055 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2056 //Set text to check if appear or not
2057 textLabel.SetProperty( TextLabel::Property::TEXT, "A");
2059 application.GetScene().Add( textLabel );
2061 application.SendNotification();
2062 application.Render();
2063 //Use GetNaturalSize to verify that size of block does not exceed Atlas size
2064 Vector3 naturalSize = textLabel.GetNaturalSize();
2066 DALI_TEST_GREATER( lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION );
2067 DALI_TEST_GREATER( lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION );
2072 int UtcDaliTextLabelHyphenWrapMode(void)
2074 ToolkitTestApplication application;
2075 tet_infoline(" UtcDaliTextLabelHyphenWrapMode ");
2078 TextLabel label = TextLabel::New();
2079 label.SetProperty( Actor::Property::SIZE, Vector2( 150.0f, 300.f ));
2080 label.SetProperty( TextLabel::Property::POINT_SIZE, 12.f );
2081 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
2082 application.GetScene().Add( label );
2083 application.SendNotification();
2084 application.Render();
2086 label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
2087 label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::HYPHENATION);
2088 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::HYPHENATION ), TEST_LOCATION );
2090 application.SendNotification();
2091 application.Render();
2093 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2099 DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
2101 label.SetProperty( TextLabel::Property::TEXT, "Hi Experimen" );
2102 label.SetProperty(TextLabel::Property::LINE_WRAP_MODE,DevelText::LineWrap::MIXED);
2103 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::MIXED ), TEST_LOCATION );
2105 application.SendNotification();
2106 application.Render();
2108 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2115 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
2120 int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
2122 ToolkitTestApplication application;
2124 tet_infoline(" utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged ");
2126 int lineCountBefore =0 ;
2127 int lineCountAfter =0 ;
2129 // Create a text editor
2130 TextLabel textLabel = TextLabel::New();
2131 //Set very large font-size using point-size
2132 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
2133 //Specify font-family
2134 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2136 textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 100.f ) );
2137 //Set text longer than width of textLabel
2138 textLabel.SetProperty( TextLabel::Property::TEXT, "Short text");
2139 //Set line wrap mode Character
2140 textLabel.SetProperty(TextLabel::Property::LINE_WRAP_MODE, "CHARACTER");
2141 textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
2143 application.GetScene().Add( textLabel );
2145 application.SendNotification();
2146 application.Render();
2149 lineCountBefore = textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2151 textLabel.SetProperty( TextLabel::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
2152 lineCountAfter = textLabel.GetProperty<int>( TextLabel::Property::LINE_COUNT );
2154 // When the text changed, the Line-count should be updated according to new text.
2155 // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
2156 DALI_TEST_EQUALS( lineCountBefore ,1, TEST_LOCATION );
2157 DALI_TEST_GREATER( lineCountAfter,1, TEST_LOCATION );
2163 int utcDaliTextLabelGeometryRTL(void)
2165 ToolkitTestApplication application;
2166 tet_infoline(" utcDaliTextLabelGeometryRTL");
2168 TextLabel label = TextLabel::New();
2169 DALI_TEST_CHECK( label );
2171 application.GetScene().Add( label );
2173 label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2174 label.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 100.f ) );
2175 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2176 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2177 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2178 label.SetProperty( TextLabel::Property::MULTI_LINE, true);
2179 label.SetProperty( TextLabel::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر" );
2181 // Avoid a crash when core load gl resources.
2182 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2184 // Render and notify
2185 application.SendNotification();
2186 application.Render();
2188 unsigned int expectedCount = 4;
2189 unsigned int startIndex = 3;
2190 unsigned int endIndex = 24;
2192 Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2193 Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2195 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2196 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2198 Vector<Vector2> expectedSizes;
2199 Vector<Vector2> expectedPositions;
2201 expectedPositions.PushBack(Vector2(24, 0));
2202 expectedSizes.PushBack(Vector2(33, 25));
2204 expectedPositions.PushBack(Vector2(-1, 25));
2205 expectedSizes.PushBack(Vector2(52, 25));
2207 expectedPositions.PushBack(Vector2(-1, 50));
2208 expectedSizes.PushBack(Vector2(59, 25));
2210 expectedPositions.PushBack(Vector2(73, 75));
2211 expectedSizes.PushBack(Vector2(37, 25));
2213 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2218 int utcDaliTextLabelGeometryGlyphMiddle(void)
2220 ToolkitTestApplication application;
2221 tet_infoline(" utcDaliTextLabelGeometryGlyphMiddle");
2223 TextLabel label = TextLabel::New();
2224 DALI_TEST_CHECK( label );
2226 application.GetScene().Add( label );
2228 label.SetProperty( TextLabel::Property::POINT_SIZE, 7.f );
2229 label.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
2230 label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
2231 label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
2232 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
2233 label.SetProperty( TextLabel::Property::TEXT, "لا تحتوي على لا" );
2235 // Avoid a crash when core load gl resources.
2236 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2238 // Render and notify
2239 application.SendNotification();
2240 application.Render();
2242 unsigned int expectedCount = 1;
2243 unsigned int startIndex = 1;
2244 unsigned int endIndex = 13;
2246 Vector<Vector2> positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
2247 Vector<Vector2> sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
2249 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
2250 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
2252 Vector<Vector2> expectedSizes;
2253 Vector<Vector2> expectedPositions;
2255 expectedPositions.PushBack(Vector2(12, 0));
2256 expectedSizes.PushBack(Vector2(118, 25));
2258 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
2263 int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
2265 ToolkitTestApplication application;
2266 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
2267 TextLabel textLabel = TextLabel::New();
2269 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
2270 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2272 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
2273 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
2274 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2276 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
2277 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
2278 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2280 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
2281 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
2282 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2284 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
2285 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
2286 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2288 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
2289 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
2290 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2292 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
2293 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
2294 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2296 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
2297 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
2298 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2300 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
2301 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
2302 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2304 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
2305 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
2306 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2308 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
2309 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
2310 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
2312 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
2313 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
2314 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
2316 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
2317 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
2318 DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
2324 int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
2326 ToolkitTestApplication application;
2327 tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
2329 TextLabel textLabel = TextLabel::New();
2330 textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
2331 textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
2332 textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
2333 textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
2335 application.GetScene().Add( textLabel );
2336 application.SendNotification();
2337 application.Render();
2339 Property::Map strikethroughMapSet;
2340 Property::Map strikethroughMapGet;
2342 strikethroughMapSet.Insert( "enable", true );
2343 strikethroughMapSet.Insert( "color", Color::RED );
2344 strikethroughMapSet.Insert( "height", 2.0f );
2346 // Check the strikethrough property
2347 textLabel.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
2348 strikethroughMapGet = textLabel.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
2349 textLabel.SetProperty( TextLabel::Property::TEXT, "Test1" );
2350 DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
2351 DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
2353 // Render and notify
2354 application.SendNotification();
2355 application.Render();
2357 strikethroughMapSet.Clear();
2358 strikethroughMapGet.Clear();