The panel is now a dashboard: a one-row header with range and provider controls, a tile per limit window with pace, forecasts, today's share of the week and the daily budget, per-day week charts with even-pace and budget lines, token stat tiles with one composition legend, hourly and daily charts side by side, limit history, and top-8 breakdowns. Colours follow fixed provider and status tokens instead of the OS accent; numbers are compact to three significant digits. Settings are grouped into cards with a sticky footer. Developer feedback on v1. Refs #5
This commit is contained in:
@@ -5,13 +5,67 @@ namespace FinalToken.App.Tests;
|
||||
|
||||
public sealed class FormattingTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(6000000000, "6 B")]
|
||||
[InlineData(2000000000, "2 B")]
|
||||
[InlineData(1500000000, "1,5 B")]
|
||||
[InlineData(600000000, "600 M")]
|
||||
[InlineData(82500, "82,5 K")]
|
||||
[InlineData(0, "0")]
|
||||
public void AxisNumbersDropTrailingZerosWithoutChangingCompactValues(double value, string expected)
|
||||
{
|
||||
var previous = CultureInfo.CurrentCulture;
|
||||
try
|
||||
{
|
||||
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");
|
||||
Assert.Equal(expected, Display.Axis(value));
|
||||
Assert.Equal("2,00 B", Display.Compact(2000000000));
|
||||
}
|
||||
finally { CultureInfo.CurrentCulture = previous; }
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(292950000, "293 M")]
|
||||
[InlineData(2300000000, "2,30 B")]
|
||||
[InlineData(966690000, "967 M")]
|
||||
[InlineData(82500, "82,5 K")]
|
||||
[InlineData(999950, "1,00 M")]
|
||||
[InlineData(0, "0")]
|
||||
public void CompactNumbersUseThreeSignificantDigits(double value, string expected)
|
||||
{
|
||||
var previous = CultureInfo.CurrentCulture;
|
||||
try { CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("de-DE"); Assert.Equal(expected, Display.Compact(value)); }
|
||||
finally { CultureInfo.CurrentCulture = previous; }
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(FinalToken.Core.PaceState.Ahead, true)]
|
||||
[InlineData(FinalToken.Core.PaceState.OnTrack, false)]
|
||||
[InlineData(FinalToken.Core.PaceState.Behind, false)]
|
||||
[InlineData(FinalToken.Core.PaceState.Unknown, false)]
|
||||
public void ForecastWarningFollowsState(FinalToken.Core.PaceState state, bool warning)
|
||||
{
|
||||
var text = Display.Forecast(new(2026, 10, 18, 14, 43, 0, TimeSpan.Zero), state);
|
||||
Assert.Equal(warning, text.Contains('⚠'));
|
||||
Assert.StartsWith(warning ? "⚠ 100 % on " : "At this pace 100 % on ", text);
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(1)]
|
||||
[InlineData(1.25)]
|
||||
[InlineData(2)]
|
||||
public void DenseBarEdgesMeetOnPhysicalPixelsWithoutGaps(double scaling)
|
||||
{
|
||||
var first = UsageChart.BarBounds(50.13, 100, 3.17, 40, scaling);
|
||||
var next = UsageChart.BarBounds(53.30, 100, 3.17, 40, scaling);
|
||||
Assert.Equal(first.Right, next.Left, 6);
|
||||
Assert.Equal(Math.Round(first.Left * scaling), first.Left * scaling, 6);
|
||||
Assert.Equal(Math.Round(first.Right * scaling), first.Right * scaling, 6);
|
||||
}
|
||||
[Fact]
|
||||
public void DailyChartLabelAndTooltipUseTheBucketsLocalDate()
|
||||
{
|
||||
var zone = TimeZoneInfo.CreateCustomTimeZone("Fixture+02", TimeSpan.FromHours(2), "Fixture", "Fixture");
|
||||
var day = FinalToken.Core.CalendarDays.Start(new DateTimeOffset(2026, 10, 14, 12, 0, 0, TimeSpan.Zero), zone);
|
||||
Assert.Equal("10-14", Display.ChartDateLabel(day, TimeSpan.FromDays(1)));
|
||||
Assert.Equal(day.DateTime.ToString("g"), Display.ChartTimestamp(day, TimeSpan.FromDays(1)));
|
||||
Assert.Equal(day.DateTime.ToString("d"), Display.ChartTimestamp(day, TimeSpan.FromDays(1)));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
|
||||
Reference in New Issue
Block a user