+ tet_infoline( "Ensure invalid string does not change wrapping mode" );
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelColorComponents(void)
+{
+ ToolkitTestApplication application;
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_RED ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_GREEN ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_BLUE ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 1.0f, TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::TEXT_COLOR_ALPHA, 0.6f );
+ DALI_TEST_EQUALS( label.GetProperty< float >( TextLabel::Property::TEXT_COLOR_ALPHA ), 0.6f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty< Vector4 >( TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR ), Vector4( 0.0f, 0.0f, 1.0f, 0.6f ), TEST_LOCATION );
+
+ // Test a transparent text - Rendering should be skipped.
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
+
+ Stage::GetCurrent().Add( label );
+
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable( true );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered
+
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::TRANSPARENT );
+
+ drawTrace.Reset();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), false, TEST_LOCATION ); // Rendering should be skipped
+
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+
+ drawTrace.Reset();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( drawTrace.FindMethod( "DrawArrays" ), true, TEST_LOCATION ); // Should be rendered again
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelTextStyle01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow");
+
+ TextLabel label = TextLabel::New();
+ label.SetSize( 300.0f, 300.f );
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" );
+ label.SetProperty( TextLabel::Property::POINT_SIZE, 12 );
+ Stage::GetCurrent().Add( label );
+
+ Property::Map outlineMapSet;
+ Property::Map outlineMapGet;
+
+ outlineMapSet["color"] = Color::BLUE;
+ outlineMapSet["width"] = 2.0f;
+ label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Map shadowMapSet;
+ shadowMapSet.Insert( "color", "green" );
+ shadowMapSet.Insert( "offset", "2 2" );
+ shadowMapSet.Insert( "blurRadius", "3" );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMapSet );
+
+ outlineMapSet["color"] = Color::RED;
+ outlineMapSet["width"] = 0.0f;
+ label.SetProperty( TextLabel::Property::OUTLINE, outlineMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ outlineMapGet = label.GetProperty<Property::Map>( TextLabel::Property::OUTLINE );
+
+ Property::Value* colorValue = outlineMapGet.Find("color");
+
+ bool colorMatched( false );
+
+ if ( colorValue )
+ {
+ Property::Type valueType = colorValue->GetType();
+
+ if ( Property::STRING == valueType )
+ {
+ std::string stringValue;
+ colorValue->Get( stringValue );
+ if ( stringValue == "red" )
+ {
+ colorMatched = true;
+ }
+ }
+ else if ( Property::VECTOR4 == valueType )
+ {
+ Vector4 colorVector4;
+ colorValue->Get( colorVector4 );
+ if ( colorVector4 == Color::RED )
+ {
+ colorMatched = true;
+ }
+ }
+ }
+
+ DALI_TEST_EQUALS( colorMatched, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelMultiline(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelMultiline");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
+ label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+ label.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ Stage::GetCurrent().Add( label );
+
+ application.SendNotification();
+ application.Render();
+
+ int lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelTextDirection(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
+ label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+ Stage::GetCurrent().Add( label );
+
+ // Test LTR text
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+ // Test RTL text
+ label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+ // Test RTL text starting with weak character
+ label.SetProperty( TextLabel::Property::TEXT, "()ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+ // Test RTL text string with emoji and weak character
+ label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 () ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelVerticalLineAlignment(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment");
+
+ TextLabel label = TextLabel::New();
+
+ label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP );
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
+ label.SetProperty( TextLabel::Property::POINT_SIZE, 15 );
+ label.SetProperty( TextLabel::Property::LINE_SPACING, 12 );
+ Stage::GetCurrent().Add( label );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION );
+
+ label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION );
+
+ label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM );
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION );
+