Skip to content

Commit

Permalink
Merge pull request #16606 from unoplatform/dev/mazi/slider-tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund authored May 8, 2024
2 parents d375917 + 8ee3dc9 commit 644e707
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using MUXControlsTestApp.Utilities;
using Uno.Extensions;
using Uno.UI.RuntimeTests.Helpers;

#if WINAPPSDK
using Uno.UI.Extensions;
#elif __IOS__
Expand Down Expand Up @@ -74,6 +75,35 @@ public async Task When_Slider_Constrained_Vertical()
Assert.AreEqual(0, slider.VerticalDecreaseRect.ActualHeight);
}

#if HAS_UNO
[TestMethod]
public async Task When_Value_Decimal()
{
if (!FeatureConfiguration.ToolTip.UseToolTips)
{
Assert.Inconclusive("ToolTips are not enabled on this target");
return;
}

var slider = new Slider()
{
Value = 0.5,
Minimum = 0,
Maximum = 1,
StepFrequency = 0.01,
Orientation = Orientation.Horizontal,
};
WindowHelper.WindowContent = slider;
await WindowHelper.WaitForLoaded(slider);

var thumb = VisualTreeUtils.FindVisualChildByName(slider, "HorizontalThumb");
var toolTip = ToolTipService.GetToolTipReference(thumb);
var tb = (TextBlock)toolTip.Content;
var text = tb.Text;
Assert.AreEqual("0.50", text);
}
#endif

#if HAS_UNO
[TestMethod]
#if !HAS_INPUT_INJECTOR
Expand Down
8 changes: 4 additions & 4 deletions src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,16 +1512,16 @@ public object Convert(object value, Type targetType, object parameter, string la
szFormat = "{0:0}";
break;
case 1:
szFormat = "{0:0.0}f";
szFormat = "{0:0.0}";
break;
case 2:
szFormat = "{0:0.00}f";
szFormat = "{0:0.00}";
break;
case 3:
szFormat = "{0:0.000}f";
szFormat = "{0:0.000}";
break;
default:
szFormat = "{0:0.0000}f";
szFormat = "{0:0.0000}";
break;
}
}
Expand Down

0 comments on commit 644e707

Please sign in to comment.