X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextLabel.cpp;h=bee836e8c00d6502f7865ff62f29d739663675d4;hb=a40aa898d6920e43ea26f80297e0753071a6be69;hp=621c634dcef0b4856695160d992fec13f1a41230;hpb=0231146907c21e934102222180a1a94b36ba0e65;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 621c634..bee836e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -69,6 +69,7 @@ const char* const PROPERTY_NAME_SHADOW = "shadow"; const char* const PROPERTY_NAME_EMBOSS = "emboss"; const char* const PROPERTY_NAME_OUTLINE = "outline"; const char* const PROPERTY_NAME_BACKGROUND = "textBackground"; +const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough"; const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize"; const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis"; @@ -355,6 +356,7 @@ int UtcDaliToolkitTextLabelGetPropertyP(void) DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE ); DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ); DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION ); + DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH ); END_TEST; } @@ -463,6 +465,19 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE ); DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION ); + Property::Map strikethroughMapSet; + Property::Map strikethroughMapGet; + + strikethroughMapSet.Insert( "enable", false ); + strikethroughMapSet.Insert( "color", Color::BLUE ); + strikethroughMapSet.Insert( "height", 2.0f ); + + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + + strikethroughMapGet = label.GetProperty( DevelTextLabel::Property::STRIKETHROUGH ); + DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION ); + Property::Map underlineMapSet; Property::Map underlineMapGet; @@ -567,6 +582,52 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f ); DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + // Check the strikethrough property + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert( "enable", true ); + strikethroughMapSet.Insert( "color", Color::RED ); + strikethroughMapSet.Insert( "height", 2.0f ); + + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + + application.SendNotification(); + application.Render(); + + strikethroughMapGet = label.GetProperty( DevelTextLabel::Property::STRIKETHROUGH ); + DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION ); + + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::ENABLE, true ); + strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED ); + strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f ); + + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + + application.SendNotification(); + application.Render(); + + strikethroughMapGet = label.GetProperty( DevelTextLabel::Property::STRIKETHROUGH ); + DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION ); + std::vector strikethroughIndicesConversionTable = { "enable", "color","height"}; + DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable ), true, TEST_LOCATION ); + + strikethroughMapSet.Clear(); + + Property::Map strikethroughDisabledMapGet; + strikethroughDisabledMapGet.Insert( "enable", false ); + strikethroughDisabledMapGet.Insert( "color", Color::RED ); + strikethroughDisabledMapGet.Insert( "height", 2.0f ); + + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + + application.SendNotification(); + application.Render(); + + strikethroughMapGet = label.GetProperty( DevelTextLabel::Property::STRIKETHROUGH ); + DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughDisabledMapGet ), true, TEST_LOCATION ); + // Check the underline property underlineMapSet.Clear(); underlineMapSet.Insert( "enable", true ); @@ -764,6 +825,12 @@ int UtcDaliToolkitTextlabelAtlasRenderP(void) shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) ); label.SetProperty( TextLabel::Property::SHADOW, shadowMap ); + Property::Map strikethroughMap; + strikethroughMap.Insert( "enable", true ); + strikethroughMap.Insert( "color", Color::GREEN ); + strikethroughMap.Insert( "height", 2.0f ); + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap ); + try { // Render some text with the shared atlas backend @@ -1755,6 +1822,14 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void) label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + Property::Map strikethroughMapSet; + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert( "enable", true ); + strikethroughMapSet.Insert( "color", Color::RED ); + strikethroughMapSet.Insert( "height", 2.0f ); + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + application.GetScene().Add( label ); application.SendNotification(); @@ -1770,6 +1845,68 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void) END_TEST; } +int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight"); + + TextLabel label = TextLabel::New(); + label.SetProperty( TextLabel::Property::TEXT, "Test" ); + label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans"); + + //Exeeding BufferWidth + label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f)); + label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT); + label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f); + + application.GetScene().Add( label ); + application.SendNotification(); + application.Render(); + + Property::Map strikethroughMapSet; + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert( "enable", true ); + strikethroughMapSet.Insert( "color", Color::BLUE); + strikethroughMapSet.Insert( "height", 2.0f); + label.SetProperty( TextLabel::Property::TEXT, "Test1" ); + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + application.GetScene().Add( label ); + application.SendNotification(); + application.Render(); + // Check if the number of renderers is 1. + DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION); + + + label = TextLabel::New(); + label.SetProperty( TextLabel::Property::TEXT, "Test" ); + label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans"); + + //Exeeding BufferHeight + label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f)); + label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT); + label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f); + + application.GetScene().Add( label ); + application.SendNotification(); + application.Render(); + + strikethroughMapSet.Clear(); + strikethroughMapSet.Insert( "enable", true ); + strikethroughMapSet.Insert( "color", Color::BLUE); + strikethroughMapSet.Insert( "height", 2.0f); + label.SetProperty( TextLabel::Property::TEXT, "Test2" ); + label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + application.GetScene().Add( label ); + application.SendNotification(); + application.Render(); + // Check if the number of renderers is 1. + DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION); + + END_TEST; +} + int UtcDaliToolkitTextlabelLastCharacterIndex(void) { ToolkitTestApplication application; @@ -1980,7 +2117,6 @@ int UtcDaliTextLabelHyphenWrapMode(void) END_TEST; } - int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void) { ToolkitTestApplication application; @@ -2184,3 +2320,42 @@ int UtcDaliToolkitTextlabelEllipsisPositionProperty(void) END_TEST; } + +int UtcDaliToolkitTextLabelStrikethroughGeneration(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration"); + + TextLabel textLabel = TextLabel::New(); + textLabel.SetProperty( TextLabel::Property::TEXT, "Test" ); + textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) ); + textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ; + textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans"); + + application.GetScene().Add( textLabel ); + application.SendNotification(); + application.Render(); + + Property::Map strikethroughMapSet; + Property::Map strikethroughMapGet; + + strikethroughMapSet.Insert( "enable", true ); + strikethroughMapSet.Insert( "color", Color::RED ); + strikethroughMapSet.Insert( "height", 2.0f ); + + // Check the strikethrough property + textLabel.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet ); + strikethroughMapGet = textLabel.GetProperty( DevelTextLabel::Property::STRIKETHROUGH ); + textLabel.SetProperty( TextLabel::Property::TEXT, "Test1" ); + DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION ); + + // Render and notify + application.SendNotification(); + application.Render(); + + strikethroughMapSet.Clear(); + strikethroughMapGet.Clear(); + + END_TEST; +} \ No newline at end of file