public void Overflow(TickBarPlacement placement, bool isDirectionReversed, double strokeThickness, double tickDiameter, string padding, string expected) { var tickBar = new LinearDotBar { StrokeThickness = strokeThickness, TickDiameter = tickDiameter, Minimum = 0, Maximum = 10, Stroke = Brushes.Black, Placement = placement, IsDirectionReversed = isDirectionReversed, Padding = padding.AsThickness(), }; 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 void SaveImage(LinearDotBar tickBar) { var size = tickBar.Placement.IsHorizontal() ? new Size(100, 10) : new Size(10, 100); Directory.CreateDirectory(@"C:\Temp\LinearDotBar"); tickBar.SaveImage( size, $@"C:\Temp\LinearDotBar\{GetFileName(tickBar)}"); }
private static string GetFileName(LinearDotBar tickBar) { var ticks = tickBar.Ticks != null ? $"_Ticks_{tickBar.Ticks}" : string.Empty; var padding = tickBar.Padding.IsZero() ? string.Empty : $"_Padding_{tickBar.Padding}"; var value = double.IsNaN(tickBar.Value) ? string.Empty : $"_Value_{tickBar.Value}"; return($@"LinearDotBar_Placement_{tickBar.Placement}_IsDirectionReversed_{tickBar.IsDirectionReversed}_Min_{tickBar.Minimum}_Max_{tickBar.Maximum}{value}{padding}{ticks}_TickFrequency_{tickBar.TickFrequency}_TickDiameter_{tickBar.TickDiameter}_StrokeThickness_{tickBar.StrokeThickness}.png" .Replace(" ", "_")); }
public void Render(TickBarPlacement placement, bool isDirectionReversed, double value, string padding) { var tickBar = new LinearDotBar { Minimum = 0, Maximum = 100, Value = value, TickFrequency = 25, Ticks = new DoubleCollection(new double[] { 10, 20, 60 }), Fill = Brushes.Red, Stroke = Brushes.Black, StrokeThickness = 1, TickDiameter = 5, Placement = placement, IsDirectionReversed = isDirectionReversed, Padding = padding.AsThickness(), }; ImageAssert.AreEqual(GetFileName(tickBar), tickBar); }