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 int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
71 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
72 const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
74 bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
76 const Property::Map::SizeType size = mapGet.Count();
78 if( size == mapSet.Count() )
80 for( unsigned int index = 0u; index < size; ++index )
82 const KeyValuePair& valueGet = mapGet.GetKeyValue( index );
84 // Find the keys of the 'get' map
85 Property::Index indexKey = valueGet.first.indexKey;
86 std::string stringKey = valueGet.first.stringKey;
88 if( !indexConversionTable.empty() )
90 if( stringKey.empty() )
92 stringKey = indexConversionTable[ indexKey ];
95 if( ( indexKey == Property::INVALID_INDEX ) && !stringKey.empty() )
97 Property::Index index = 0u;
98 for( auto key : indexConversionTable )
100 if( key == stringKey )
110 const Property::Value* const valueSet = mapSet.Find( indexKey, stringKey );
112 if( nullptr != valueSet )
114 if( ( valueSet->GetType() == Dali::Property::STRING ) && ( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() ) )
116 tet_printf( "Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
119 else if( ( valueSet->GetType() == Dali::Property::BOOLEAN ) && ( valueGet.second.Get<bool>() != valueSet->Get<bool>() ) )
121 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>() );
124 else if( ( valueSet->GetType() == Dali::Property::INTEGER ) && ( valueGet.second.Get<int>() != valueSet->Get<int>() ) )
126 tet_printf( "Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
129 else if( ( valueSet->GetType() == Dali::Property::FLOAT ) && ( valueGet.second.Get<float>() != valueSet->Get<float>() ) )
131 tet_printf( "Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>() );
134 else if( ( valueSet->GetType() == Dali::Property::VECTOR2 ) && ( valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>() ) )
136 Vector2 vector2Get = valueGet.second.Get<Vector2>();
137 Vector2 vector2Set = valueSet->Get<Vector2>();
138 tet_printf( "Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y );
141 else if( ( valueSet->GetType() == Dali::Property::VECTOR4 ) && ( valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>() ) )
143 Vector4 vector4Get = valueGet.second.Get<Vector4>();
144 Vector4 vector4Set = valueSet->Get<Vector4>();
145 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 );
151 if ( valueGet.first.type == Property::Key::INDEX )
153 tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
157 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
169 int UtcDaliToolkitTextLabelConstructorP(void)
171 ToolkitTestApplication application;
172 tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
174 DALI_TEST_CHECK( !textLabel );
178 int UtcDaliToolkitTextLabelNewP(void)
180 ToolkitTestApplication application;
181 tet_infoline(" UtcDaliToolkitTextLabelNewP");
182 TextLabel textLabel = TextLabel::New( "Test Text" );
183 DALI_TEST_CHECK( textLabel );
187 int UtcDaliToolkitTextLabelDownCastP(void)
189 ToolkitTestApplication application;
190 tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
191 TextLabel textLabel1 = TextLabel::New();
192 BaseHandle object( textLabel1 );
194 TextLabel textLabel2 = TextLabel::DownCast( object );
195 DALI_TEST_CHECK( textLabel2 );
197 TextLabel textLabel3 = DownCast< TextLabel >( object );
198 DALI_TEST_CHECK( textLabel3 );
202 int UtcDaliToolkitTextLabelDownCastN(void)
204 ToolkitTestApplication application;
205 tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
206 BaseHandle uninitializedObject;
207 TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
208 DALI_TEST_CHECK( !textLabel1 );
210 TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
211 DALI_TEST_CHECK( !textLabel2 );
215 int UtcDaliToolkitTextLabelCopyConstructorP(void)
217 ToolkitTestApplication application;
218 tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
219 TextLabel textLabel = TextLabel::New();
220 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
222 TextLabel copy( textLabel );
223 DALI_TEST_CHECK( copy );
224 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
228 int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
230 ToolkitTestApplication application;
231 tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
232 TextLabel textLabel = TextLabel::New();
233 textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
235 TextLabel copy = textLabel;
236 DALI_TEST_CHECK( copy );
237 DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
241 // Positive test case for a method
242 int UtcDaliToolkitTextLabelGetPropertyP(void)
244 ToolkitTestApplication application;
245 tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
246 TextLabel label = TextLabel::New("Test Text");
247 DALI_TEST_CHECK( label );
249 // Check Property Indices are correct
250 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextLabel::Property::RENDERING_BACKEND );
251 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextLabel::Property::TEXT );
252 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextLabel::Property::FONT_FAMILY );
253 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextLabel::Property::FONT_STYLE );
254 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextLabel::Property::POINT_SIZE );
255 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_MULTI_LINE ) == TextLabel::Property::MULTI_LINE );
256 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextLabel::Property::HORIZONTAL_ALIGNMENT );
257 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextLabel::Property::VERTICAL_ALIGNMENT );
258 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextLabel::Property::TEXT_COLOR );
259 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP) == TextLabel::Property::ENABLE_MARKUP );
260 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) == TextLabel::Property::ENABLE_AUTO_SCROLL );
261 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
262 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
263 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
264 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
265 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
266 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
267 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
268 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
269 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextLabel::Property::BACKGROUND );
270 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextLabel::Property::PIXEL_SIZE );
271 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
272 DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
277 int UtcDaliToolkitTextLabelSetPropertyP(void)
279 ToolkitTestApplication application;
280 tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
281 TextLabel label = TextLabel::New();
282 DALI_TEST_CHECK( label );
284 Stage::GetCurrent().Add( label );
286 // Note - we can't check the defaults since the stylesheets are platform-specific
287 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
288 DALI_TEST_EQUALS( (Text::RenderingType)label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
290 // Check that text can be correctly reset
291 label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
292 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
294 // Check font properties.
295 label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
296 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
298 Property::Map fontStyleMapSet;
299 Property::Map fontStyleMapGet;
301 fontStyleMapSet.Insert( "weight", "bold" );
302 fontStyleMapSet.Insert( "width", "condensed" );
303 fontStyleMapSet.Insert( "slant", "italic" );
304 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
306 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
307 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
308 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
310 // Check the old font style format.
311 fontStyleMapSet.Clear();
312 fontStyleMapSet.Insert( "weight", "thin" );
313 fontStyleMapSet.Insert( "width", "expanded" );
314 fontStyleMapSet.Insert( "slant", "oblique" );
315 const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
317 label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
318 std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
319 DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
321 label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
322 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
325 fontStyleMapSet.Clear();
326 fontStyleMapSet.Insert( "weight", "normal" );
327 fontStyleMapSet.Insert( "slant", "oblique" );
329 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
330 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
331 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
332 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
334 fontStyleMapSet.Clear();
335 fontStyleMapSet.Insert( "slant", "roman" );
337 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
338 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
339 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
341 // Replace 'roman' for 'normal'.
342 Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
343 if( NULL != slantValue )
345 if( "normal" == slantValue->Get<std::string>() )
347 fontStyleMapGet["slant"] = "roman";
350 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
352 fontStyleMapSet.Clear();
354 label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
355 fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
356 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
357 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
360 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
361 DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
363 // Check that the Alignment properties can be correctly set
364 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
365 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::HORIZONTAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
366 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
367 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
369 // Check that text color can be properly set
370 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
371 DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
373 Property::Map underlineMapSet;
374 Property::Map underlineMapGet;
376 underlineMapSet.Insert( "enable", "false" );
377 underlineMapSet.Insert( "color", "blue" );
378 underlineMapSet.Insert( "height", "0" );
380 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
381 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
382 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
384 TextLabel label2 = TextLabel::New( "New text" );
385 DALI_TEST_CHECK( label2 );
386 DALI_TEST_EQUALS( label2.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("New text"), TEST_LOCATION );
388 // Check the enable markup property.
389 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
390 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
391 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_MARKUP ) );
393 // Check the text property when markup is enabled
394 label.SetProperty( TextLabel::Property::TEXT, "<color value='white'>Markup</color><color value='cyan'>Text</color>" );
395 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string("MarkupText"), TEST_LOCATION );
397 application.SendNotification();
398 application.Render();
400 // Check autoscroll properties
401 const int SCROLL_SPEED = 80;
402 const int SCROLL_LOOPS = 4;
403 const float SCROLL_GAP = 50.0f;
404 const float SCROLL_LOOP_DELAY = 0.3f;
405 const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" );
406 const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" );
408 label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
409 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
410 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
411 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
412 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED );
413 DALI_TEST_EQUALS( SCROLL_SPEED, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_SPEED ), TEST_LOCATION );
414 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS );
415 DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
416 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
417 DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
418 label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
419 DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
421 //Check autoscroll stop type property
422 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
423 DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
425 label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
426 DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty<std::string>( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION );
428 // test natural size with multi-line and line spacing
430 TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
431 Vector3 oneLineNaturalSize = label3.GetNaturalSize();
432 label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
433 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
434 Vector3 multiLineNaturalSize = label3.GetNaturalSize();
436 // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
437 // The height of the text when multi-line is enabled will be larger
438 DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
439 DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
441 // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
442 // Everything else will remain the same
443 int lineSpacing = 20;
444 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
445 Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
446 expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
447 DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
450 // single line, line spacing must not affect natural size of the text, only add the spacing to the height
452 TextLabel label3 = TextLabel::New("Some text here end there end here");
453 label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
454 label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
455 Vector3 textNaturalSize = label3.GetNaturalSize();
456 int lineSpacing = 20;
457 label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
458 Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
459 expectedNaturalSizeWithLineSpacing.height += lineSpacing;
460 DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
462 // Check the line spacing property
463 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
464 label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
465 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
467 // Check the underline property
468 underlineMapSet.Clear();
469 underlineMapSet.Insert( "enable", "true" );
470 underlineMapSet.Insert( "color", "red" );
471 underlineMapSet.Insert( "height", "1" );
473 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
475 application.SendNotification();
476 application.Render();
478 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
479 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
480 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
482 underlineMapSet.Clear();
483 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, "true" );
484 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, "green" );
485 underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, "2" );
487 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
489 application.SendNotification();
490 application.Render();
492 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
493 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
494 std::vector<std::string> underlineIndicesConversionTable = { "enable", "color", "height" };
495 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet, underlineIndicesConversionTable ), true, TEST_LOCATION );
497 underlineMapSet.Clear();
499 Property::Map underlineDisabledMapGet;
500 underlineDisabledMapGet.Insert( "enable", "false" );
501 underlineDisabledMapGet.Insert( "color", "green" );
502 underlineDisabledMapGet.Insert( "height", "2" );
504 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
506 application.SendNotification();
507 application.Render();
509 underlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::UNDERLINE );
510 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineDisabledMapGet.Count(), TEST_LOCATION );
511 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineDisabledMapGet ), true, TEST_LOCATION );
513 // Check the shadow property
515 Property::Map shadowMapSet;
516 Property::Map shadowMapGet;
518 shadowMapSet.Insert( "color", Color::GREEN );
519 shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
520 shadowMapSet.Insert( "blurRadius", 5.0f );
522 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
524 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
525 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
526 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
528 shadowMapSet.Clear();
530 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
531 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, "3.0 3.0" );
532 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
534 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
536 // Replace the offset (string) by a vector2
537 shadowMapSet.Clear();
538 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::COLOR, Color::BLUE );
539 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::OFFSET, Vector2( 3.0, 3.0 ) );
540 shadowMapSet.Insert( Toolkit::DevelText::Shadow::Property::BLUR_RADIUS, 3.0f );
542 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
543 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
544 std::vector<std::string> shadowIndicesConversionTable = { "color", "offset", "blurRadius" };
545 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet, shadowIndicesConversionTable ), true, TEST_LOCATION );
547 shadowMapSet.Clear();
548 Property::Map shadowDisabledMapGet;
549 shadowDisabledMapGet.Insert( "color", Color::BLUE );
550 shadowDisabledMapGet.Insert( "offset", Vector2(0.0f, 0.0f) );
551 shadowDisabledMapGet.Insert( "blurRadius", 3.0f );
553 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
555 shadowMapGet = label.GetProperty<Property::Map>( TextLabel::Property::SHADOW );
556 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowDisabledMapGet.Count(), TEST_LOCATION );
557 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowDisabledMapGet ), true, TEST_LOCATION );
559 // Check the emboss property
560 label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
561 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
563 // Check the outline property
565 // Test string type first
566 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
567 label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
568 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
570 // Then test the property map type
571 Property::Map outlineMapSet;
572 Property::Map outlineMapGet;
574 outlineMapSet["color"] = Color::RED;
575 outlineMapSet["width"] = 2.0f;
576 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
578 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
579 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
580 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
582 outlineMapSet.Clear();
583 outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
584 outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
585 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
587 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
588 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
589 std::vector<std::string> outlineIndicesConversionTable = { "color", "width" };
590 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet, outlineIndicesConversionTable ), true, TEST_LOCATION );
592 // Check the background property
593 Property::Map backgroundMapSet;
594 Property::Map backgroundMapGet;
596 backgroundMapSet["enable"] = true;
597 backgroundMapSet["color"] = Color::RED;
598 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
600 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
601 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
602 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet ), true, TEST_LOCATION );
604 backgroundMapSet.Clear();
605 backgroundMapSet[Toolkit::DevelText::Background::Property::ENABLE] = true;
606 backgroundMapSet[Toolkit::DevelText::Background::Property::COLOR] = Color::GREEN;
607 label.SetProperty( DevelTextLabel::Property::BACKGROUND, backgroundMapSet );
609 backgroundMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::BACKGROUND );
610 DALI_TEST_EQUALS( backgroundMapGet.Count(), backgroundMapSet.Count(), TEST_LOCATION );
611 std::vector<std::string> backgroundIndicesConversionTable = { "enable", "color" };
612 DALI_TEST_EQUALS( DaliTestCheckMaps( backgroundMapGet, backgroundMapSet, backgroundIndicesConversionTable ), true, TEST_LOCATION );
614 // Check the pixel size of font
615 label.SetProperty( TextLabel::Property::PIXEL_SIZE, 20.f );
616 DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
618 // Check the ellipsis property
619 DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
620 label.SetProperty( TextLabel::Property::ELLIPSIS, false );
621 DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
623 // Check the layout direction property
624 label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
625 DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
627 application.SendNotification();
628 application.Render();
633 int UtcDaliToolkitTextlabelAtlasRenderP(void)
635 ToolkitTestApplication application;
636 tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
637 TextLabel label = TextLabel::New("Test Text");
638 DALI_TEST_CHECK( label );
640 // Avoid a crash when core load gl resources.
641 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
643 Stage::GetCurrent().Add( label );
645 // Turn on all the effects
646 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
647 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
649 Property::Map underlineMap;
650 underlineMap.Insert( "enable", "true" );
651 underlineMap.Insert( "color", "red" );
652 label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap );
654 Property::Map shadowMap;
655 shadowMap.Insert( "color", Color::BLUE );
656 shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
657 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
661 // Render some text with the shared atlas backend
662 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
663 application.SendNotification();
664 application.Render();
668 tet_result(TET_FAIL);
673 // Render some text with the shared atlas backend
674 label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_VECTOR_BASED );
675 application.SendNotification();
676 application.Render();
680 tet_result(TET_FAIL);
685 int UtcDaliToolkitTextLabelLanguagesP(void)
687 ToolkitTestApplication application;
688 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
689 TextLabel label = TextLabel::New();
690 DALI_TEST_CHECK( label );
692 Stage::GetCurrent().Add( label );
694 const std::string scripts( " привет мир, γειά σου Κόσμε, Hello world, مرحبا بالعالم, שלום עולם, "
695 "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
696 "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
697 "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
698 "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
699 "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
701 label.SetProperty( TextLabel::Property::TEXT, scripts );
702 DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
704 application.SendNotification();
705 application.Render();
710 int UtcDaliToolkitTextLabelEmojisP(void)
712 ToolkitTestApplication application;
713 tet_infoline(" UtcDaliToolkitTextLabelLanguagesP");
714 TextLabel label = TextLabel::New();
715 DALI_TEST_CHECK( label );
717 Stage::GetCurrent().Add( label );
719 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
721 char* pathNamePtr = get_current_dir_name();
722 const std::string pathName( pathNamePtr );
725 TextAbstraction::FontDescription fontDescription;
726 fontDescription.path = pathName + DEFAULT_FONT_DIR + "/tizen/BreezeColorEmoji.ttf";
727 fontDescription.family = "BreezeColorEmoji";
728 fontDescription.width = TextAbstraction::FontWidth::NONE;
729 fontDescription.weight = TextAbstraction::FontWeight::NORMAL;
730 fontDescription.slant = TextAbstraction::FontSlant::NONE;
732 fontClient.GetFontId( fontDescription, EMOJI_FONT_SIZE );
734 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>";
735 label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
736 label.SetProperty( TextLabel::Property::TEXT, emojis );
738 Property::Map shadowMap;
739 shadowMap.Insert( "color", "green" );
740 shadowMap.Insert( "offset", "2 2" );
741 label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
743 application.SendNotification();
744 application.Render();
749 int UtcDaliToolkitTextlabelScrollingP(void)
751 ToolkitTestApplication application;
752 tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
753 TextLabel labelImmediate = TextLabel::New("Some text to scroll");
754 TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
756 DALI_TEST_CHECK( labelImmediate );
757 DALI_TEST_CHECK( labelFinished );
758 // Avoid a crash when core load gl resources.
759 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
760 Stage::GetCurrent().Add( labelImmediate );
761 // Turn on all the effects
762 labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false );
763 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
764 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
765 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
766 labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
768 Stage::GetCurrent().Add( labelFinished );
769 // Turn on all the effects
770 labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false );
771 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
772 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
773 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
774 labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
780 // Render some text with the shared atlas backend
781 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
782 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
784 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
785 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
787 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
788 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
789 application.SendNotification();
790 application.Render();
792 labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
793 labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
794 application.SendNotification();
795 application.Render();
800 tet_result(TET_FAIL);
806 int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
808 ToolkitTestApplication application;
809 TextLabel labelShort = TextLabel::New("Some text to scroll");
810 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!");
812 DALI_TEST_CHECK( labelShort );
813 DALI_TEST_CHECK( labelLong );
814 // Avoid a crash when core load gl resources.
815 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
816 Stage::GetCurrent().Add( labelShort );
817 // Turn on all the effects
818 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
819 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
820 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
821 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
822 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
823 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
825 Stage::GetCurrent().Add( labelLong );
826 // Turn on all the effects
827 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
828 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
829 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
830 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
831 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
832 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
836 // Render some text with the shared atlas backend
837 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
838 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
839 application.SendNotification();
840 application.Render();
842 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
843 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
844 application.SendNotification();
845 application.Render();
850 tet_result(TET_FAIL);
856 int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
858 ToolkitTestApplication application;
859 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
860 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
862 DALI_TEST_CHECK( labelShort );
863 DALI_TEST_CHECK( labelLong );
864 // Avoid a crash when core load gl resources.
865 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
866 Stage::GetCurrent().Add( labelShort );
867 // Turn on all the effects
868 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
869 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
870 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
871 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
872 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
873 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
875 Stage::GetCurrent().Add( labelLong );
876 // Turn on all the effects
877 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
878 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
879 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
880 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
881 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
882 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
886 // Render some text with the shared atlas backend
887 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
888 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
889 application.SendNotification();
890 application.Render();
892 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
893 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
894 application.SendNotification();
895 application.Render();
900 tet_result(TET_FAIL);
906 int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
908 ToolkitTestApplication application;
909 TextLabel labelShort = TextLabel::New("Some text to scroll");
910 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!");
912 DALI_TEST_CHECK( labelShort );
913 DALI_TEST_CHECK( labelLong );
914 // Avoid a crash when core load gl resources.
915 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
916 Stage::GetCurrent().Add( labelShort );
917 // Turn on all the effects
918 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
919 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
920 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
921 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
922 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
923 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
925 Stage::GetCurrent().Add( labelLong );
926 // Turn on all the effects
927 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
928 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
929 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
930 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
931 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
932 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
936 // Render some text with the shared atlas backend
937 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
938 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
939 application.SendNotification();
940 application.Render();
942 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
943 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
944 application.SendNotification();
945 application.Render();
950 tet_result(TET_FAIL);
956 int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
958 ToolkitTestApplication application;
959 TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
960 TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
962 DALI_TEST_CHECK( labelShort );
963 DALI_TEST_CHECK( labelLong );
964 // Avoid a crash when core load gl resources.
965 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
966 Stage::GetCurrent().Add( labelShort );
967 // Turn on all the effects
968 labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
969 labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
970 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
971 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
972 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
973 labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE );
975 Stage::GetCurrent().Add( labelLong );
976 // Turn on all the effects
977 labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
978 labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
979 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
980 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
981 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
982 labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP );
986 // Render some text with the shared atlas backend
987 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
988 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
989 application.SendNotification();
990 application.Render();
992 labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
993 labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
994 application.SendNotification();
995 application.Render();
1000 tet_result(TET_FAIL);
1006 int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
1008 ToolkitTestApplication application;
1009 tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
1010 TextLabel label = TextLabel::New("Some text to scroll");
1011 DALI_TEST_CHECK( label );
1012 // Avoid a crash when core load gl resources.
1013 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1014 Stage::GetCurrent().Add( label );
1015 label.SetSize( 360.0f, 20.f );
1016 // Turn on all the effects
1017 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1018 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1019 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1020 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1023 application.SendNotification();
1024 application.Render();
1026 unsigned int actorCount1 = label.GetChildCount();
1027 tet_printf("Initial actor count is(%d)\n", actorCount1 );
1031 // Render some text with the shared atlas backend
1032 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1033 application.SendNotification();
1034 application.Render(2000);
1036 unsigned int actorCount1 = label.GetChildCount();
1037 tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
1039 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1042 application.SendNotification();
1043 application.Render();
1045 unsigned int actorCount2 = label.GetChildCount();
1046 tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
1048 DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
1053 tet_result(TET_FAIL);
1059 int UtcDaliToolkitTextlabelScrollingN(void)
1061 ToolkitTestApplication application;
1062 tet_infoline(" UtcDaliToolkitTextlabelScrollingN");
1064 TextLabel label = TextLabel::New("Some text to scroll");
1065 DALI_TEST_CHECK( label );
1067 Stage::GetCurrent().Add( label );
1069 // Avoid a crash when core load gl resources.
1070 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1072 // The text scrolling works only on single line text.
1073 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1075 // Turn on all the effects.
1076 label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
1077 label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
1078 label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
1080 // Enable the auto scrolling effect.
1081 label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
1083 // The auto scrolling shouldn't be enabled.
1084 const bool enabled = label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ).Get<bool>();
1085 DALI_TEST_CHECK( !enabled );
1090 int UtcDaliToolkitTextlabelEllipsis(void)
1092 ToolkitTestApplication application;
1093 tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
1095 TextLabel label = TextLabel::New("Hello world");
1096 DALI_TEST_CHECK( label );
1098 // Avoid a crash when core load gl resources.
1099 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1101 Stage::GetCurrent().Add( label );
1103 // Turn on all the effects
1104 label.SetAnchorPoint( AnchorPoint::CENTER );
1105 label.SetParentOrigin( ParentOrigin::CENTER );
1106 label.SetSize( 360.0f, 10.f );
1111 application.SendNotification();
1112 application.Render();
1116 tet_result(TET_FAIL);
1119 label.SetProperty( TextLabel::Property::TEXT, "Hello world " );
1120 label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
1121 label.SetSize( 400.0f, 10.f );
1126 application.SendNotification();
1127 application.Render();
1131 tet_result(TET_FAIL);
1135 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1136 label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
1137 label.SetSize( 400.0f, 10.f );
1142 application.SendNotification();
1143 application.Render();
1147 tet_result(TET_FAIL);
1153 int UtcDaliToolkitTextlabelTextWrapMode(void)
1155 ToolkitTestApplication application;
1156 tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
1160 TextLabel label = TextLabel::New();
1161 label.SetSize( 300.0f, 300.f );
1162 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1163 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1167 //label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
1168 Stage::GetCurrent().Add( label );
1170 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
1171 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1173 application.SendNotification();
1174 application.Render();
1176 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1177 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1179 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
1180 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1182 application.SendNotification();
1183 application.Render();
1185 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
1186 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
1188 application.SendNotification();
1189 application.Render();
1191 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1192 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
1194 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
1195 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1197 application.SendNotification();
1198 application.Render();
1200 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1201 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
1203 tet_infoline( "Ensure invalid string does not change wrapping mode" );
1204 label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
1205 DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
1210 int UtcDaliToolkitTextLabelColorComponents(void)
1212 ToolkitTestApplication application;
1214 TextLabel label = TextLabel::New();
1215 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1216 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 1.0f, TEST_LOCATION );
1217 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1218 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1219 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1221 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
1222 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1223 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
1224 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
1225 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1227 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1228 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
1229 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
1230 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 1.0f, TEST_LOCATION );
1231 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
1233 label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
1234 DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
1235 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1236 DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
1238 // Test a transparent text - Rendering should be skipped.
1239 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1240 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
1242 Stage::GetCurrent().Add( label );
1244 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
1245 drawTrace.Enable( true );
1247 application.SendNotification();
1248 application.Render();
1250 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered
1252 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
1256 application.SendNotification();
1257 application.Render();
1259 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
1261 label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
1265 application.SendNotification();
1266 application.Render();
1268 DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
1273 int UtcDaliToolkitTextlabelTextStyle01(void)
1275 ToolkitTestApplication application;
1276 tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
1278 TextLabel label = TextLabel::New();
1279 label.SetSize( 300.0f, 300.f );
1280 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
1281 label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
1282 Stage::GetCurrent().Add( label );
1284 Property::Map outlineMapSet;
1285 Property::Map outlineMapGet;
1287 outlineMapSet["color"] = Color::BLUE;
1288 outlineMapSet["width"] = 2.0f;
1289 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1291 application.SendNotification();
1292 application.Render();
1294 Property::Map shadowMapSet;
1295 shadowMapSet.Insert( "color", "green" );
1296 shadowMapSet.Insert( "offset", "2 2" );
1297 shadowMapSet.Insert( "blurRadius", "3" );
1298 label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
1300 outlineMapSet["color"] = Color::RED;
1301 outlineMapSet["width"] = 0.0f;
1302 label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
1304 application.SendNotification();
1305 application.Render();
1307 outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
1309 Property::Value* colorValue = outlineMapGet.Find("color");
1311 bool colorMatched( false );
1315 Property::Type valueType = colorValue->GetType();
1317 if ( Property::STRING == valueType )
1319 std::string stringValue;
1320 colorValue->Get( stringValue );
1321 if ( stringValue == "red" )
1323 colorMatched = true;
1326 else if ( Property::VECTOR4 == valueType )
1328 Vector4 colorVector4;
1329 colorValue->Get( colorVector4 );
1330 if ( colorVector4 == Color::RED )
1332 colorMatched = true;
1337 DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
1342 int UtcDaliToolkitTextlabelMultiline(void)
1344 ToolkitTestApplication application;
1345 tet_infoline(" UtcDaliToolkitTextlabelMultiline");
1347 TextLabel label = TextLabel::New();
1348 label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
1349 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1350 label.SetProperty( TextLabel::Property::MULTI_LINE, false );
1351 Stage::GetCurrent().Add( label );
1353 application.SendNotification();
1354 application.Render();
1356 int lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1357 DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
1359 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
1361 application.SendNotification();
1362 application.Render();
1364 lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
1365 DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
1371 int UtcDaliToolkitTextlabelTextDirection(void)
1373 ToolkitTestApplication application;
1374 tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
1376 TextLabel label = TextLabel::New();
1377 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1379 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1380 label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
1381 Stage::GetCurrent().Add( label );
1384 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
1387 label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1388 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1390 // Test RTL text starting with weak character
1391 label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1392 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1394 // Test RTL text string with emoji and weak character
1395 label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
1396 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
1401 int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
1403 ToolkitTestApplication application;
1404 tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
1406 TextLabel label = TextLabel::New();
1408 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP );
1409 label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
1410 label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
1411 label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
1412 Stage::GetCurrent().Add( label );
1413 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
1415 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE );
1416 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
1418 label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM );
1419 DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );