app: list every model in the reset tooltip
agent-review agent review: pass

The tooltip showed five models and folded the rest into a count, and no
other view shows a past instance's models. D12 asks for tokens and API value
by model for every instance, so the tooltip now lists all of them.

Refs #14
This commit is contained in:
Florian Schmidt
2026-10-18 11:04:57 +02:00
parent 5da543eba8
commit 058c2b5324
4 changed files with 51 additions and 2 deletions
+36
View File
@@ -14,6 +14,7 @@ internal static class ResetViews
{
public static void Verify(Action<Window, string> save)
{
VerifyEveryModelsTokensAndValue(save);
VerifyScenarios(save);
var fixture = ResetFixture.Create();
var clock = new FixedClock(fixture.Now);
@@ -106,6 +107,41 @@ internal static class ResetViews
}
}
private static void VerifyEveryModelsTokensAndValue(Action<Window, string> save)
{
var fixture = ResetFixture.ManyModels();
var history = fixture.History.Resets[0];
var row = history.Instances[1];
Assert.False(row.Running); Assert.Equal(9, row.Models.Count);
foreach (var theme in new[] { ThemeVariant.Dark, ThemeVariant.Light })
{
var card = new ResetCard(history, new(ResetColumn.Start), new FixedClock(fixture.Now));
var window = new Window { Width = 1280, Height = 1030, RequestedThemeVariant = theme,
Content = new Border { Padding = new Thickness(24), Child = Ui.Card(Ui.Stack(Ui.Text("Codex · Week", 15), card)) } };
Ui.Theme(window); window.Show(); Dispatcher.UIThread.RunJobs();
using (window.CaptureRenderedFrame()) { }
var cell = card.GetVisualDescendants().OfType<Grid>().Single(g => g.Name == "ResetRows")
.Children.OfType<TextBlock>().Single(t => Grid.GetRow(t) == 2 && Grid.GetColumn(t) == 0);
var tip = Assert.IsType<DataTooltip>(ToolTip.GetTip(cell));
foreach (var model in row.Models)
{
var detail = Assert.Single(tip.Rows, r => r.Label == model.Model);
Assert.Equal(DataTooltip.Count(model.Tokens.Total) + " · " + Display.Money(model.ApiValue), detail.Value);
}
Assert.Equal(row.Models.Select(m => m.Model), tip.Rows.Where(r => row.Models.Any(m => m.Model == r.Label)).Select(r => r.Label));
Assert.DoesNotContain(tip.Rows, r => r.Label == "Other models");
var pointer = cell.TranslatePoint(new Point(12, cell.Bounds.Height / 2), window)!.Value;
window.MouseMove(pointer); ToolTip.SetIsOpen(cell, true); Dispatcher.UIThread.RunJobs();
using (window.CaptureRenderedFrame()) { }
Assert.True(ToolTip.GetIsOpen(cell)); Assert.True(tip.Bounds.Width > 320);
var bounds = new PixelRect(tip.PointToScreen(default), PixelSize.FromSize(tip.Bounds.Size, 1));
Assert.False(bounds.Contains(window.PointToScreen(pointer)));
Assert.True(window.Screens.ScreenFromWindow(window)!.WorkingArea.Contains(bounds), $"tooltip {bounds}");
save(window, $"resets-many-models-hover-{theme}.png");
ToolTip.SetIsOpen(cell, false); window.Close();
}
}
private static void VerifyScenarios(Action<Window, string> save)
{
foreach (var (name, fixture) in new[] { ("running-only", ResetFixture.RunningOnly()),