2 * Copyright (c) 2019 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>
29 using namespace Toolkit;
31 void dali_textlabel_startup(void)
33 test_return_value = TET_UNDEF;
36 void dali_textlabel_cleanup(void)
38 test_return_value = TET_PASS;
44 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
45 const char* const PROPERTY_NAME_TEXT = "text";
46 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
47 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
48 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
49 const char* const PROPERTY_NAME_MULTI_LINE = "multiLine";
50 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
51 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
52 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
53 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
54 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll";
55 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed";
56 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
57 const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
59 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
60 const char* const PROPERTY_NAME_UNDERLINE = "underline";
61 const char* const PROPERTY_NAME_SHADOW = "shadow";
62 const char* const PROPERTY_NAME_EMBOSS = "emboss";
63 const char* const PROPERTY_NAME_OUTLINE = "outline";
64 const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
66 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
67 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
68 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
70 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
71 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
73 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
75 const Property::Map::SizeType size = mapGet.Count();
77 if( size == mapSet.Count() )
79 for( unsigned int index = 0u; index < size; ++index )
81 const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
83 // Find the keys of the 'get' map
84 Property::Index indexKey = valueGet.first.indexKey;
85 std::string stringKey = valueGet.first.stringKey;
87 if( !indexConversionTable.empty() )
89 if( stringKey.empty() )
91 stringKey = indexConversionTable[ indexKey ];
94 if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
96 Property::Index index = 0u;
97 for( auto key : indexConversionTable )
99 if( key == stringKey )
109 const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
111 if( nullptr != valueSet )
113 if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
115 tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
118 else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
120 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
123 else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
125 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
128 else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
130 tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
133 else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
135 Vector2 vector2Get = valueGet.second.Get<Vector2>();
136 Vector2 vector2Set = valueSet->Get<Vector2>();
137 tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
140 else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
142 Vector4 vector4Get = valueGet.second.Get<Vector4>();
143 Vector4 vector4Set = valueSet->Get<Vector4>();
144 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 );
150 if ( valueGet.first.type == Property::Key::INDEX )
152 tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
156 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
168 int UtcDaliToolkitTextLabelConstructorP(void)
170 ToolkitTestApplication application;
171 tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
173 DALI_TEST_CHECK( !textLabel );
177 int UtcDaliToolkitTextLabelNewP(void)
179 ToolkitTestApplication application;
180 tet_infoline(" UtcDaliToolkitTextLabelNewP");
181 TextLabel textLabel = TextLabel::New( "Test Text" );
182 DALI_TEST_CHECK( textLabel );
186 int UtcDaliToolkitTextLabelDownCastP(void)
188 ToolkitTestApplication application;
189 tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
190 TextLabel textLabel1 = TextLabel::New();
191 BaseHandle object( textLabel1 );
193 TextLabel textLabel2 = TextLabel::DownCast( object );
194 DALI_TEST_CHECK( textLabel2 );
196 TextLabel textLabel3 = DownCast< TextLabel >( object );
197 DALI_TEST_CHECK( textLabel3 );
201 int UtcDaliToolkitTextLabelDownCastN(void)
203 ToolkitTestApplication application;
204 tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
205 BaseHandle uninitializedObject;
206 TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
207 DALI_TEST_CHECK( !textLabel1 );
209 TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
210 DALI_TEST_CHECK( !textLabel2 );
214 int UtcDaliToolkitTextLabelCopyConstructorP(void)
216 ToolkitTestApplication application;
217 tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
218 TextLabel textLabel = TextLabel::New();
219 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
221 TextLabel copy( textLabel );
222 DALI_TEST_CHECK( copy );
223 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
227 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
229 ToolkitTestApplication application;
230 tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
231 TextLabel textLabel = TextLabel::New();
232 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
234 TextLabel copy = textLabel;
235 DALI_TEST_CHECK( copy );
236 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
240 // Positive test case for a method
241 int UtcDaliToolkitTextLabelGetPropertyP(void)
243 ToolkitTestApplication application;
244 tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
245 TextLabel label = TextLabel::New("Test Text");
246 DALI_TEST_CHECK( label );
248 // Check Property Indices are correct
249 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextLabel::Property::RENDERING_BACKEND );
250 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
251 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
252 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
253 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
254 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
255 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
256 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
257 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
258 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
259 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
260 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
261 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
262 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
263 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
264 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
265 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
266 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
267 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
268 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
269 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
270 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
271 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
276 int UtcDaliToolkitTextLabelSetPropertyP(void)
278 ToolkitTestApplication application;
279 tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
280 TextLabel label = TextLabel::New();
281 DALI_TEST_CHECK( label );
283 Stage::GetCurrent().Add( label );
285 // Note - we can't check the defaults since the stylesheets are platform-specific
286 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
287 DALI_TEST_EQUALS( (Text::RenderingType)label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
289 // Check that text can be correctly reset
290 label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
291 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
293 // Check font properties.
294 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
295 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
297 Property::Map fontStyleMapSet;
298 Property::Map fontStyleMapGet;
300 fontStyleMapSet.Insert( "weight", "bold" );
301 fontStyleMapSet.Insert( "width", "condensed" );
302 fontStyleMapSet.Insert( "slant", "italic" );
303 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
305 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
306 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
307 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
309 // Check the old font style format.
310 fontStyleMapSet.Clear();
311 fontStyleMapSet.Insert( "weight", "thin" );
312 fontStyleMapSet.Insert( "width", "expanded" );
313 fontStyleMapSet.Insert( "slant", "oblique" );
314 const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
316 label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
317 std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
318 DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
320 label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
321 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
324 fontStyleMapSet.Clear();
325 fontStyleMapSet.Insert( "weight", "normal" );
326 fontStyleMapSet.Insert( "slant", "oblique" );
328 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
329 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
330 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
331 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
333 fontStyleMapSet.Clear();
334 fontStyleMapSet.Insert( "slant", "roman" );
336 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
337 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
338 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
340 // Replace 'roman' for 'normal'.
341 Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
342 if( NULL != slantValue )
344 if( "normal" == slantValue->Get<std::string>() )
346 fontStyleMapGet["slant"] = "roman";
349 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
351 fontStyleMapSet.Clear();
353 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
354 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
355 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
356 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
359 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
360 DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
362 // Check that the Alignment properties can be correctly set
363 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
364 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
365 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
366 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
368 // Check that text color can be properly set
369 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
370 DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
372 Property::Map underlineMapSet;
373 Property::Map underlineMapGet;
375 underlineMapSet.Insert( "enable", false );
376 underlineMapSet.Insert( "color", Color::BLUE );
377 underlineMapSet.Insert( "height", 0 );
379 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
380 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
381 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
383 TextLabel label2 = TextLabel::New( "New text" );
384 DALI_TEST_CHECK( label2 );
385 DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
387 // Check the enable markup property.
388 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
389 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
390 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
392 // Check the text property when markup is enabled
393 label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
394 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
396 application.SendNotification();
397 application.Render();
399 // Check autoscroll properties
400 const int SCROLL_SPEED = 80;
401 const int SCROLL_LOOPS = 4;
402 const float SCROLL_GAP = 50.0f;
403 const float SCROLL_LOOP_DELAY = 0.3f;
404 const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
405 const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
407 label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
408 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
409 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
410 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
411 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
412 DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
413 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
414 DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
415 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
416 DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
417 label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
418 DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
420 //Check autoscroll stop type property
421 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
422 DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
424 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
425 DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
427 // test natural size with multi-line and line spacing
429 TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
430 Vector3 oneLineNaturalSize = label3.GetNaturalSize();
431 label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
432 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
433 Vector3 multiLineNaturalSize = label3.GetNaturalSize();
435 // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
436 // The height of the text when multi-line is enabled will be larger
437 DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
438 DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
440 // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
441 // Everything else will remain the same
442 int lineSpacing = 20;
443 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
444 Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
445 expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
446 DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
449 // single line, line spacing must not affect natural size of the text, only add the spacing to the height
451 TextLabel label3 = TextLabel::New("Some text here end there end here");
452 label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
453 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
454 Vector3 textNaturalSize = label3.GetNaturalSize();
455 int lineSpacing = 20;
456 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
457 Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
458 expectedNaturalSizeWithLineSpacing.height += lineSpacing;
459 DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
461 // Check the line spacing property
462 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
463 label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
464 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
466 // Check the underline property
467 underlineMapSet.Clear();
468 underlineMapSet.Insert( "enable", true );
469 underlineMapSet.Insert( "color", Color::RED );
470 underlineMapSet.Insert( "height", 1 );
472 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
474 application.SendNotification();
475 application.Render();
477 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
478 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
479 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
481 underlineMapSet.Clear();
482 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true );
483 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN );
484 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 );
486 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
488 application.SendNotification();
489 application.Render();
491 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
492 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
493 std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
494 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
496 underlineMapSet.Clear();
498 Property::Map underlineDisabledMapGet;
499 underlineDisabledMapGet.Insert( "enable", false );
500 underlineDisabledMapGet.Insert( "color", Color::GREEN );
501 underlineDisabledMapGet.Insert( "height", 2 );
503 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
505 application.SendNotification();
506 application.Render();
508 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
509 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
510 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
512 // Check the shadow property
514 Property::Map shadowMapSet;
515 Property::Map shadowMapGet;
517 shadowMapSet.Insert( "color", Color::GREEN );
518 shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
519 shadowMapSet.Insert( "blurRadius", 5.0f );
521 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
523 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
524 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
525 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
527 shadowMapSet.Clear();
529 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
530 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
531 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
533 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
535 // Replace the offset (string) by a vector2
536 shadowMapSet.Clear();
537 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
538 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
539 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
541 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
542 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
543 std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
544 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
546 shadowMapSet.Clear();
547 Property::Map shadowDisabledMapGet;
548 shadowDisabledMapGet.Insert( "color", Color::BLUE );
549 shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
550 shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
552 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
554 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
555 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
556 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
558 // Check the emboss property
559 label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
560 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
562 // Check the outline property
564 // Test string type first
565 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
566 label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
567 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
569 // Then test the property map type
570 Property::Map outlineMapSet;
571 Property::Map outlineMapGet;
573 outlineMapSet["color"] = Color::RED;
574 outlineMapSet["width"] = 2.0f;
575 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
577 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
578 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
579 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
581 outlineMapSet.Clear();
582 outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
583 outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
584 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
586 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
587 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
588 std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
589 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
591 // Check the background property
592 Property::Map backgroundMapSet;
593 Property::Map backgroundMapGet;
595 backgroundMapSet["enable"] = true;
596 backgroundMapSet["color"] = Color::RED;
597 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
599 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
600 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
601 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
603 backgroundMapSet.Clear();
604 backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
605 backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
606 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
608 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
609 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
610 std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
611 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
613 // Check the pixel size of font
614 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
615 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
617 // Check the ellipsis property
618 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
619 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
620 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
622 // Check the layout direction property
623 label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
624 DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
626 application.SendNotification();
627 application.Render();
632 int UtcDaliToolkitTextlabelAtlasRenderP(void)
634 ToolkitTestApplication application;
635 tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
636 TextLabel label = TextLabel::New("Test Text");
637 DALI_TEST_CHECK( label );
639 // Avoid a crash when core load gl resources.
640 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
642 Stage::GetCurrent().Add( label );
644 // Turn on all the effects
645 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
646 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
648 Property::Map underlineMap;
649 underlineMap.Insert( "enable", true );
650 underlineMap.Insert( "color", Color::RED );
651 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
653 Property::Map shadowMap;
654 shadowMap.Insert( "color", Color::BLUE );
655 shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
656 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
660 // Render some text with the shared atlas backend
661 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
662 application.SendNotification();
663 application.Render();
667 tet_result(TET_FAIL);
672 // Render some text with the shared atlas backend
673 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_VECTOR_BASED );
674 application.SendNotification();
675 application.Render();
679 tet_result(TET_FAIL);
684 int UtcDaliToolkitTextLabelLanguagesP(void)
686 ToolkitTestApplication application;
687 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
688 TextLabel label = TextLabel::New();
689 DALI_TEST_CHECK( label );
691 Stage::GetCurrent().Add( label );
693 const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
694 "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
695 "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
696 "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
697 "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
698 "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
700 label.SetProperty( TextLabel::Property::TEXT, scripts );
701 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
703 application.SendNotification();
704 application.Render();
709 int UtcDaliToolkitTextLabelEmojisP(void)
711 ToolkitTestApplication application;
712 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
713 TextLabel label = TextLabel::New();
714 DALI_TEST_CHECK( label );
716 Stage::GetCurrent().Add( label );
718 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
720 char* pathNamePtr = get_current_dir_name();
721 const std::string pathName( pathNamePtr );
724 TextAbstraction::FontDescription fontDescription;
725 fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
726 fontDescription.family = "BreezeColorEmoji";
727 fontDescription.width = TextAbstraction::FontWidth::NONE;
728 fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
729 fontDescription.slant = TextAbstraction::FontSlant::NONE;
731 fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
733 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>";
734 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
735 label.SetProperty( TextLabel::Property::TEXT, emojis );
737 Property::Map shadowMap;
738 shadowMap.Insert( "color", "green" );
739 shadowMap.Insert( "offset", "2 2" );
740 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
742 application.SendNotification();
743 application.Render();
748 int UtcDaliToolkitTextlabelScrollingP(void)
750 ToolkitTestApplication application;
751 tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
752 TextLabel labelImmediate = TextLabel::New("Some text to scroll");
753 TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
755 DALI_TEST_CHECK( labelImmediate );
756 DALI_TEST_CHECK( labelFinished );
757 // Avoid a crash when core load gl resources.
758 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
759 Stage::GetCurrent().Add( labelImmediate );
760 // Turn on all the effects
761 labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
762 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
763 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
764 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
765 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
767 Stage::GetCurrent().Add( labelFinished );
768 // Turn on all the effects
769 labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
770 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
771 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
772 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
773 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
779 // Render some text with the shared atlas backend
780 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
781 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
783 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
784 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
786 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
787 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
788 application.SendNotification();
789 application.Render();
791 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
792 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
793 application.SendNotification();
794 application.Render();
799 tet_result(TET_FAIL);
805 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
807 ToolkitTestApplication application;
808 TextLabel labelShort = TextLabel::New("Some text to scroll");
809 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!");
811 DALI_TEST_CHECK( labelShort );
812 DALI_TEST_CHECK( labelLong );
813 // Avoid a crash when core load gl resources.
814 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
815 Stage::GetCurrent().Add( labelShort );
816 // Turn on all the effects
817 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
818 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
819 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
820 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
821 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
822 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
824 Stage::GetCurrent().Add( labelLong );
825 // Turn on all the effects
826 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
827 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
828 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
829 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
830 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
831 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
835 // Render some text with the shared atlas backend
836 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
837 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
838 application.SendNotification();
839 application.Render();
841 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
842 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
843 application.SendNotification();
844 application.Render();
849 tet_result(TET_FAIL);
855 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
857 ToolkitTestApplication application;
858 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
859 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
861 DALI_TEST_CHECK( labelShort );
862 DALI_TEST_CHECK( labelLong );
863 // Avoid a crash when core load gl resources.
864 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
865 Stage::GetCurrent().Add( labelShort );
866 // Turn on all the effects
867 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
868 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
869 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
870 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
871 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
872 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
874 Stage::GetCurrent().Add( labelLong );
875 // Turn on all the effects
876 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
877 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
878 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
879 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
880 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
881 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
885 // Render some text with the shared atlas backend
886 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
887 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
888 application.SendNotification();
889 application.Render();
891 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
892 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
893 application.SendNotification();
894 application.Render();
899 tet_result(TET_FAIL);
905 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
907 ToolkitTestApplication application;
908 TextLabel labelShort = TextLabel::New("Some text to scroll");
909 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!");
911 DALI_TEST_CHECK( labelShort );
912 DALI_TEST_CHECK( labelLong );
913 // Avoid a crash when core load gl resources.
914 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
915 Stage::GetCurrent().Add( labelShort );
916 // Turn on all the effects
917 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
918 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
919 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
920 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
921 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
922 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
924 Stage::GetCurrent().Add( labelLong );
925 // Turn on all the effects
926 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
927 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
928 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
929 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
930 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
931 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
935 // Render some text with the shared atlas backend
936 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
937 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
938 application.SendNotification();
939 application.Render();
941 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
942 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
943 application.SendNotification();
944 application.Render();
949 tet_result(TET_FAIL);
955 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
957 ToolkitTestApplication application;
958 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
959 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
961 DALI_TEST_CHECK( labelShort );
962 DALI_TEST_CHECK( labelLong );
963 // Avoid a crash when core load gl resources.
964 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
965 Stage::GetCurrent().Add( labelShort );
966 // Turn on all the effects
967 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
968 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
969 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
970 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
971 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
972 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
974 Stage::GetCurrent().Add( labelLong );
975 // Turn on all the effects
976 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
977 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
978 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
979 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
980 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
981 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
985 // Render some text with the shared atlas backend
986 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
987 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
988 application.SendNotification();
989 application.Render();
991 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
992 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
993 application.SendNotification();
994 application.Render();
999 tet_result(TET_FAIL);
1005 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1007 ToolkitTestApplication application;
1008 tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1009 TextLabel label = TextLabel::New("Some text to scroll");
1010 DALI_TEST_CHECK( label );
1011 // Avoid a crash when core load gl resources.
1012 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1013 Stage::GetCurrent().Add( label );
1014 label.SetSize( 360.0f, 20.f );
1015 // Turn on all the effects
1016 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1017 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1018 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1019 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1022 application.SendNotification();
1023 application.Render();
1025 unsigned int actorCount1 = label.GetChildCount();
1026 tet_printf("Initial actor count is(%d)\n", actorCount1 );
1030 // Render some text with the shared atlas backend
1031 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1032 application.SendNotification();
1033 application.Render(2000);
1035 unsigned int actorCount1 = label.GetChildCount();
1036 tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1038 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1041 application.SendNotification();
1042 application.Render();
1044 unsigned int actorCount2 = label.GetChildCount();
1045 tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1047 DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1052 tet_result(TET_FAIL);
1058 int UtcDaliToolkitTextlabelScrollingN(void)
1060 ToolkitTestApplication application;
1061 tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1063 TextLabel label = TextLabel::New("Some text to scroll");
1064 DALI_TEST_CHECK( label );
1066 Stage::GetCurrent().Add( label );
1068 // Avoid a crash when core load gl resources.
1069 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1071 // The text scrolling works only on single line text.
1072 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1074 // Turn on all the effects.
1075 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1076 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1077 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1079 // Enable the auto scrolling effect.
1080 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1082 // The auto scrolling shouldn't be enabled.
1083 const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1084 DALI_TEST_CHECK( !enabled );
1089 int UtcDaliToolkitTextlabelEllipsis(void)
1091 ToolkitTestApplication application;
1092 tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1094 TextLabel label = TextLabel::New("Hello world");
1095 DALI_TEST_CHECK( label );
1097 // Avoid a crash when core load gl resources.
1098 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1100 Stage::GetCurrent().Add( label );
1102 // Turn on all the effects
1103 label.SetAnchorPoint( AnchorPoint::CENTER );
1104 label.SetParentOrigin( ParentOrigin::CENTER );
1105 label.SetSize( 360.0f, 10.f );
1110 application.SendNotification();
1111 application.Render();
1115 tet_result(TET_FAIL);
1118 label.SetProperty( TextLabel::Property::TEXT, "Hello world " );
1119 label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1120 label.SetSize( 400.0f, 10.f );
1125 application.SendNotification();
1126 application.Render();
1130 tet_result(TET_FAIL);
1134 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1135 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1136 label.SetSize( 400.0f, 10.f );
1141 application.SendNotification();
1142 application.Render();
1146 tet_result(TET_FAIL);
1152 int UtcDaliToolkitTextlabelTextWrapMode(void)
1154 ToolkitTestApplication application;
1155 tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1159 TextLabel label = TextLabel::New();
1160 label.SetSize( 300.0f, 300.f );
1161 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1162 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1166 //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1167 Stage::GetCurrent().Add( label );
1169 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1170 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1172 application.SendNotification();
1173 application.Render();
1175 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1176 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1178 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1179 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1181 application.SendNotification();
1182 application.Render();
1184 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1185 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1187 application.SendNotification();
1188 application.Render();
1190 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1191 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1193 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1194 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1196 application.SendNotification();
1197 application.Render();
1199 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1200 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
1202 tet_infoline( "Ensure invalid string does not change wrapping mode" );
1203 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1204 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1209 int UtcDaliToolkitTextLabelColorComponents(void)
1211 ToolkitTestApplication application;
1213 TextLabel label = TextLabel::New();
1214 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1215 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 1.0f, TEST_LOCATION );
1216 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1217 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1218 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1220 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1221 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1222 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1223 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1224 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1226 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1227 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1228 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1229 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 1.0f, TEST_LOCATION );
1230 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1232 label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1233 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1234 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1235 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1237 // Test a transparent text - Rendering should be skipped.
1238 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1239 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1241 Stage::GetCurrent().Add( label );
1243 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1244 drawTrace.Enable( true );
1246 application.SendNotification();
1247 application.Render();
1249 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered
1251 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1255 application.SendNotification();
1256 application.Render();
1258 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1260 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1264 application.SendNotification();
1265 application.Render();
1267 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1272 int UtcDaliToolkitTextlabelTextStyle01(void)
1274 ToolkitTestApplication application;
1275 tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1277 TextLabel label = TextLabel::New();
1278 label.SetSize( 300.0f, 300.f );
1279 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1280 label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1281 Stage::GetCurrent().Add( label );
1283 Property::Map outlineMapSet;
1284 Property::Map outlineMapGet;
1286 outlineMapSet["color"] = Color::BLUE;
1287 outlineMapSet["width"] = 2.0f;
1288 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1290 application.SendNotification();
1291 application.Render();
1293 Property::Map shadowMapSet;
1294 shadowMapSet.Insert( "color", "green" );
1295 shadowMapSet.Insert( "offset", "2 2" );
1296 shadowMapSet.Insert( "blurRadius", "3" );
1297 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1299 outlineMapSet["color"] = Color::RED;
1300 outlineMapSet["width"] = 0.0f;
1301 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1303 application.SendNotification();
1304 application.Render();
1306 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1308 Property::Value* colorValue = outlineMapGet.Find("color");
1310 bool colorMatched( false );
1314 Property::Type valueType = colorValue->GetType();
1316 if ( Property::STRING == valueType )
1318 std::string stringValue;
1319 colorValue->Get( stringValue );
1320 if ( stringValue == "red" )
1322 colorMatched = true;
1325 else if ( Property::VECTOR4 == valueType )
1327 Vector4 colorVector4;
1328 colorValue->Get( colorVector4 );
1329 if ( colorVector4 == Color::RED )
1331 colorMatched = true;
1336 DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1341 int UtcDaliToolkitTextlabelMultiline(void)
1343 ToolkitTestApplication application;
1344 tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1346 TextLabel label = TextLabel::New();
1347 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1348 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1349 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1350 Stage::GetCurrent().Add( label );
1352 application.SendNotification();
1353 application.Render();
1355 int lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1356 DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1358 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1360 application.SendNotification();
1361 application.Render();
1363 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1364 DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1370 int UtcDaliToolkitTextlabelTextDirection(void)
1372 ToolkitTestApplication application;
1373 tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1375 TextLabel label = TextLabel::New();
1376 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1378 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1379 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1380 Stage::GetCurrent().Add( label );
1383 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1386 label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1387 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1389 // Test RTL text starting with weak character
1390 label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1391 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1393 // Test RTL text string with emoji and weak character
1394 label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1395 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1400 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1402 ToolkitTestApplication application;
1403 tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1405 TextLabel label = TextLabel::New();
1407 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP );
1408 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1409 label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1410 label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1411 Stage::GetCurrent().Add( label );
1412 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1414 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE );
1415 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1417 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM );
1418 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );