From e50e9862014f01ea06a82f78addf1ede66e974b6 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Tue, 12 Feb 2019 19:13:30 +0900 Subject: [PATCH] Fix Underline property issue if an underline is not set a string, property map is set to value. Change-Id: I3036d036d7178d59d26e6608f01c3aa69cf562f8 Signed-off-by: huiyu.eun --- .../src/dali-toolkit/utc-Dali-TextEditor.cpp | 12 +++++----- .../src/dali-toolkit/utc-Dali-TextField.cpp | 6 ++--- .../src/dali-toolkit/utc-Dali-TextLabel.cpp | 28 +++++++++++----------- .../src/dali-toolkit/utc-Dali-Visual.cpp | 2 +- dali-toolkit/internal/text/text-effects-style.cpp | 13 +++------- 5 files changed, 27 insertions(+), 34 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 3e3b0e3..251b339 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -761,9 +761,9 @@ int UtcDaliTextEditorSetPropertyP(void) Property::Map underlineMapSet; Property::Map underlineMapGet; - underlineMapSet.Insert( "enable", "true" ); - underlineMapSet.Insert( "color", "red" ); - underlineMapSet.Insert( "height", "1" ); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::RED ); + underlineMapSet.Insert( "height", 1 ); editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet ); @@ -2596,9 +2596,9 @@ int utcDaliTextEditorUnderPropertyStringP(void) // Check the input underline property Property::Map underlineMapSet; Property::Map underlineMapGet; - underlineMapSet.Insert( "enable", "true" ); - underlineMapSet.Insert( "color", "blue" ); - underlineMapSet.Insert( "height", "2" ); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::BLUE ); + underlineMapSet.Insert( "height", 2 ); editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet ); underlineMapGet = editor.GetProperty( TextEditor::Property::UNDERLINE ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 39cd605..8b1005f 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -806,9 +806,9 @@ int UtcDaliTextFieldSetPropertyP(void) Property::Map underlineMapSet; Property::Map underlineMapGet; - underlineMapSet.Insert( "enable", "true" ); - underlineMapSet.Insert( "color", "red" ); - underlineMapSet.Insert( "height", "1" ); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::RED ); + underlineMapSet.Insert( "height", 1 ); // Check the underline property field.SetProperty( TextField::Property::UNDERLINE, underlineMapSet ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 551acf2..1208543 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -372,9 +372,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) Property::Map underlineMapSet; Property::Map underlineMapGet; - underlineMapSet.Insert( "enable", "false" ); - underlineMapSet.Insert( "color", "blue" ); - underlineMapSet.Insert( "height", "0" ); + underlineMapSet.Insert( "enable", false ); + underlineMapSet.Insert( "color", Color::BLUE ); + underlineMapSet.Insert( "height", 0 ); underlineMapGet = label.GetProperty( TextLabel::Property::UNDERLINE ); DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION ); @@ -465,9 +465,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) // Check the underline property underlineMapSet.Clear(); - underlineMapSet.Insert( "enable", "true" ); - underlineMapSet.Insert( "color", "red" ); - underlineMapSet.Insert( "height", "1" ); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::RED ); + underlineMapSet.Insert( "height", 1 ); label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); @@ -479,9 +479,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION ); underlineMapSet.Clear(); - underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, "true" ); - underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, "green" ); - underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, "2" ); + underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::ENABLE, true ); + underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::COLOR, Color::GREEN ); + underlineMapSet.Insert( Toolkit::DevelText::Underline::Property::HEIGHT, 2 ); label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); @@ -496,9 +496,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) underlineMapSet.Clear(); Property::Map underlineDisabledMapGet; - underlineDisabledMapGet.Insert( "enable", "false" ); - underlineDisabledMapGet.Insert( "color", "green" ); - underlineDisabledMapGet.Insert( "height", "2" ); + underlineDisabledMapGet.Insert( "enable", false ); + underlineDisabledMapGet.Insert( "color", Color::GREEN ); + underlineDisabledMapGet.Insert( "height", 2 ); label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); @@ -646,8 +646,8 @@ int UtcDaliToolkitTextlabelAtlasRenderP(void) label.SetProperty( TextLabel::Property::MULTI_LINE, true ); Property::Map underlineMap; - underlineMap.Insert( "enable", "true" ); - underlineMap.Insert( "color", "red" ); + underlineMap.Insert( "enable", true ); + underlineMap.Insert( "color", Color::RED ); label.SetProperty( TextLabel::Property::UNDERLINE, underlineMap ); Property::Map shadowMap; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index c4df701..4e259e1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1193,7 +1193,7 @@ int UtcDaliVisualGetPropertyMap10(void) propertyMap.Insert( "shadow", shadowMapSet.Add("color", Color::RED).Add("offset", Vector2(2.0f, 2.0f)).Add("blurRadius", 3.0f) ); Property::Map underlineMapSet; - propertyMap.Insert( "underline", underlineMapSet.Add("enable", "true").Add("color", "green").Add("height", "1") ); + propertyMap.Insert( "underline", underlineMapSet.Add("enable", true).Add("color", Color::GREEN).Add("height", 1) ); Property::Map outlineMapSet; propertyMap.Insert( "outline", outlineMapSet.Add("color", Color::YELLOW).Add("width", 1) ); diff --git a/dali-toolkit/internal/text/text-effects-style.cpp b/dali-toolkit/internal/text/text-effects-style.cpp index f65655b..10d9da4 100755 --- a/dali-toolkit/internal/text/text-effects-style.cpp +++ b/dali-toolkit/internal/text/text-effects-style.cpp @@ -358,16 +358,9 @@ void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, E { Property::Map map; - const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN; - map.Insert( ENABLE_KEY, enabledStr ); - - std::string colorStr; - Vector4ToColorString( color, colorStr ); - map.Insert( COLOR_KEY, colorStr ); - - std::string heightStr; - FloatToString( height, heightStr ); - map.Insert( HEIGHT_KEY, heightStr ); + map.Insert( ENABLE_KEY, enabled ); + map.Insert( COLOR_KEY, color ); + map.Insert( HEIGHT_KEY, height ); value = map; } -- 2.7.4