build: one version for the app and the plugin
D11 replaces an installed plugin only when the shipped manifest is newer, but the manifest version was kept by hand and still said 1.0.0.1, the version of a test build installed before the snapshot sharing and appPath fixes, so that stale plugin was never replaced. Directory.Build.props now holds the only version, 1.0.1; publish.py stamps it into the shipped manifest and the app shows it in its title. Tests that waited on real time (file retry, popup expiry) use controlled timers, and real process waits have wider margins. Refs #1
This commit is contained in:
@@ -31,6 +31,7 @@ public sealed class HeadlessTests
|
||||
var model = FakeData.Model();
|
||||
var panel = new PanelWindow(model, () => { }, () => { }, () => { }, () => { }) { Height = 2450 };
|
||||
panel.RequestedThemeVariant = ThemeVariant.Light; panel.Show(); Save(panel, "panel-light.png");
|
||||
Assert.Equal($"FinalToken {typeof(Program).Assembly.GetName().Version!.ToString(3)}", panel.Title);
|
||||
Assert.Contains(panel.GetVisualDescendants().OfType<TextBlock>(), t => t.Text == "Claude");
|
||||
Assert.Contains(panel.GetVisualDescendants().OfType<TextBlock>(), t => t.Text == "Tokens per day");
|
||||
var filters = panel.GetVisualDescendants().OfType<ComboBox>().ToArray();
|
||||
@@ -74,7 +75,8 @@ public sealed class HeadlessTests
|
||||
var install = new PopupWindow("Stream Deck plugin", "Update ready", () => { }, "Update", () => installed++);
|
||||
install.Show(); install.GetVisualDescendants().OfType<Button>().Single(b => b.Content as string == "Update").RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
Assert.Equal(1, installed);
|
||||
using var stack = new PopupStack(() => { });
|
||||
var popupClock = new PopupClock();
|
||||
using var stack = new PopupStack(() => { }, popupClock);
|
||||
var first = PopupWindow.Pace(new(Provider.Claude, "a", "Session", PaceState.Ahead, 20, null), () => { });
|
||||
var second = PopupWindow.Pace(new(Provider.Codex, "b", "Week", PaceState.Behind, -20, null), () => { });
|
||||
stack.Show(first); stack.Show(second); Assert.True(second.Position.Y < first.Position.Y);
|
||||
@@ -94,8 +96,9 @@ public sealed class HeadlessTests
|
||||
{ Values = [new(time, "Claude", 1), new(time.AddHours(1), "Claude", 2), new(time.AddHours(2), "Claude", 3)] })),
|
||||
Width = 620, Height = 260, RequestedThemeVariant = ThemeVariant.Light };
|
||||
smallChart.Show(); Save(smallChart, "chart-max-3.png", polishShots); smallChart.Close();
|
||||
Thread.Sleep(8200); Dispatcher.UIThread.RunJobs();
|
||||
popupClock.Fire(); Dispatcher.UIThread.RunJobs();
|
||||
Assert.False(first.IsVisible); Assert.False(second.IsVisible);
|
||||
Assert.All(popupClock.Timers, timer => Assert.True(timer.Disposed));
|
||||
completion.SetResult();
|
||||
void Save(Window window, string name, string? destination = null)
|
||||
{
|
||||
@@ -112,4 +115,23 @@ public sealed class HeadlessTests
|
||||
}
|
||||
public sealed class TestApplication : Application
|
||||
{ public override void Initialize() => Styles.Add(new FluentTheme()); }
|
||||
private sealed class PopupClock : TimeProvider
|
||||
{
|
||||
public List<PopupTimer> Timers { get; } = [];
|
||||
public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
|
||||
{
|
||||
Assert.Equal(TimeSpan.FromSeconds(8), dueTime);
|
||||
Assert.Equal(Timeout.InfiniteTimeSpan, period);
|
||||
var timer = new PopupTimer(callback, state); Timers.Add(timer); return timer;
|
||||
}
|
||||
public void Fire() { foreach (var timer in Timers.Where(t => !t.Disposed)) timer.Fire(); }
|
||||
}
|
||||
private sealed class PopupTimer(TimerCallback callback, object? state) : ITimer
|
||||
{
|
||||
public bool Disposed { get; private set; }
|
||||
public void Fire() => callback(state);
|
||||
public bool Change(TimeSpan dueTime, TimeSpan period) => throw new NotSupportedException();
|
||||
public void Dispose() => Disposed = true;
|
||||
public ValueTask DisposeAsync() { Dispose(); return ValueTask.CompletedTask; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user