From 379e3fd4336ee4edafa8edf165514e1e24c69ca6 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 28 Oct 2026 07:19:44 -0400 Subject: [PATCH] fix(ui): preview the selected version in the database browser Highlighting an earlier version on the Versions tab left the plates, drawings and plate preview on the current version, so there was no way to see what a historical version looked like without opening it. The embedded history now reports its selection and the browser downloads that version (debounced, cached per history view) and shows it, labelled as historical; selecting the current version returns to it. Co-Authored-By: Claude Opus 5.5 --- .../Forms/SavedNestsFormTests.cs | 60 +++++++++- OpenNest/Forms/NestHistoryForm.cs | 35 +++++- OpenNest/Forms/SavedNestsForm.cs | 108 ++++++++++++++++-- 3 files changed, 185 insertions(+), 18 deletions(-) diff --git a/OpenNest.WinForms.Tests/Forms/SavedNestsFormTests.cs b/OpenNest.WinForms.Tests/Forms/SavedNestsFormTests.cs index 43268457..1a638346 100644 --- a/OpenNest.WinForms.Tests/Forms/SavedNestsFormTests.cs +++ b/OpenNest.WinForms.Tests/Forms/SavedNestsFormTests.cs @@ -59,6 +59,56 @@ public class SavedNestsFormTests "The saved-nest dialog test did not complete."); } + [Fact] + public void SelectingAHistoricalVersion_ShowsItsPlatesInTheDetailsAndPreview() + { + StaTestThread.Run( + () => + { + var job = Record("Versioned job"); + var current = NestFile((Quantity: 1, Parts: 1)); + var earlier = NestFile((Quantity: 1, Parts: 3), (Quantity: 1, Parts: 2)); + job.Revision = 3; + job.FileSize = current.Length; + var repository = new FakeRepository(job); + repository.Files[job.Id] = current; + repository.RevisionFiles[(job.Id, 2)] = earlier; + repository.Revisions[job.Id] = + [ + new NestRecord { Id = job.Id, Revision = 3, Name = job.Name, FileSize = current.Length }, + new NestRecord { Id = job.Id, Revision = 2, Name = job.Name, FileSize = earlier.Length }, + ]; + + using var form = new SavedNestsForm(repository); + form.Show(); + var plates = Field(form, "platesGrid"); + var preview = Field(form, "platePreview"); + var status = Field