public void Overflow(TickBarPlacement placement, bool isDirectionReversed, string padding, string expected) { var tickBar = new LinearTextBar { Minimum = 0, Maximum = 10, TickFrequency = 1, Placement = placement, IsDirectionReversed = isDirectionReversed, Padding = padding.AsThickness(), FontFamily = new FontFamily("Arial"), // Seoge UI is measured differently on Win 7 and Win 10 for some reason FontSize = 12, }; var gauge = new LinearGauge { Content = tickBar }; gauge.Arrange(new Rect(new Size(10, 10))); Assert.AreEqual(expected, gauge.ContentOverflow.ToString()); Assert.AreEqual(expected, tickBar.Overflow.ToString()); gauge.Measure(new Size(10, 10)); gauge.Arrange(new Rect(new Size(10, 10))); Assert.AreEqual(expected, gauge.ContentOverflow.ToString()); Assert.AreEqual(expected, tickBar.Overflow.ToString()); }
private static string GetFileName(LinearTextBar tickBar) { if (tickBar.Ticks is null && DoubleUtil.AreClose(tickBar.TickFrequency, 0)) { return($"LinearTextBar_Placement_{tickBar.Placement}_Empty.png"); } var ticks = tickBar.Ticks != null ? $"_Ticks_{tickBar.Ticks}" : string.Empty; var padding = tickBar.Padding.IsZero() ? string.Empty : $"_Padding_{tickBar.Padding}"; var tickFrequency = tickBar.TickFrequency > 0 ? $"_TickFrequency_{tickBar.TickFrequency}" : string.Empty; var textPosition = tickBar.TextPosition is ExplicitLinearTextPosition explicitPos ? $"_Explicit_{explicitPos.Horizontal}_{explicitPos.Vertical}" : "_Default"; return($@"LinearTextBar_Placement_{tickBar.Placement}_Min_{tickBar.Minimum}_Max_{tickBar.Maximum}_IsDirectionReversed_{tickBar.IsDirectionReversed}{textPosition}{tickFrequency}{ticks}{padding}.png" .Replace(" ", "_")); }
private static void SaveImage(LinearTextBar tickBar) { Directory.CreateDirectory(@"C:\Temp\LinearTextBar"); var size = tickBar.Placement.IsHorizontal() ? new Size(100, 15) : new Size(15, 100); tickBar.SaveImage(size, $@"C:\Temp\LinearTextBar\{GetFileName(tickBar)}"); }
public void RenderWithDefaultPosition(TestCase testCase) { var tickBar = new LinearTextBar { Minimum = 0, Maximum = 10, TickFrequency = testCase.TickFrequency, Ticks = testCase.Ticks, Placement = testCase.Placement, IsDirectionReversed = testCase.IsDirectionReversed, Padding = testCase.Padding, FontFamily = new FontFamily("Arial"), // Seoge UI is measured differently on Win 7 and Win 10 for some reason FontSize = 12, }; ImageAssert.AreEqual(GetFileName(tickBar), tickBar); }