From 2a3ec42bfd53724a87fdae8893d33cdca6a9d263 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 18 Oct 2023 16:16:27 +0900 Subject: [PATCH] [NUI] Make View.TooltipText return valid value Let we remove useless error message + Make getter return valid setting value for View.TooltipText property. Signed-off-by: Eunki, Hong --- .../src/public/BaseComponents/View.cs | 20 +++++++++++++++---- .../testcase/public/TSView.cs | 19 ++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 059284387b0..afd95458c59 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -856,12 +856,24 @@ private string InternalTooltipText { using (var propertyValue = GetProperty(Property.TOOLTIP)) { - if (propertyValue != null && propertyValue.Get(out string retrivedValue)) + using var propertyMap = new PropertyMap(); + if (propertyValue != null && propertyValue.Get(propertyMap)) { - return retrivedValue; + using var retrivedContentValue = propertyMap?.Find(NDalic.TooltipContent); + if (retrivedContentValue != null) + { + using var contextPropertyMap = new PropertyMap(); + if (retrivedContentValue.Get(contextPropertyMap)) + { + using var retrivedTextValue = contextPropertyMap?.Find(NDalic.TextVisualText); + if (retrivedTextValue != null && retrivedTextValue.Get(out string retrivedValue)) + { + return retrivedValue; + } + } + } } - NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!"); - return "error to get TooltipText"; + return ""; } } set diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSView.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSView.cs index b350ca8e481..3a2ecb63dbb 100644 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSView.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSView.cs @@ -207,5 +207,24 @@ public void ColorBlue_GET_SET_VALUE() testView.Dispose(); } + + + [Test] + [Category("P1")] + [Description("Get value test for View.ToolTipText")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ToolTipText")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "eunkiki.hong@samsung.com")] + public void ToolTipText_GET_SET_VALUE() + { + /* TEST CODE */ + View testView = new View(); + + testView.TooltipText = "tooltipText"; + Assert.AreEqual("tooltipText", testView.TooltipText, "Should get equal string value what we set before"); + + testView.Dispose(); + } } }