From d6ae7060989c3fb8ca0d632f7ecd60775dd90af0 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 11 Oct 2026 22:15:08 -0400 Subject: [PATCH] refactor(cutting-ui): retire redundant planning and validation forms --- .../Controls/ValidationOverlayTests.cs | 47 ++ .../Forms/CuttingInspectionPanelTests.cs | 98 +++- .../Forms/CuttingPlanFormTests.cs | 348 ------------ .../Forms/CuttingUiRetirementTests.cs | 19 + .../Forms/CuttingValidationPanelTests.cs | 49 ++ .../Forms/ValidateNestFormTests.cs | 302 ---------- OpenNest/Forms/CuttingInspectionPanel.cs | 8 + OpenNest/Forms/CuttingPlanForm.Designer.cs | 291 ---------- OpenNest/Forms/CuttingPlanForm.cs | 514 ------------------ OpenNest/Forms/EditNestForm.cs | 25 - OpenNest/Forms/MainForm.cs | 23 +- OpenNest/Forms/ValidateNestForm.cs | 326 ----------- OpenNest/Forms/ValidationInspectionScope.cs | 5 - docs/cutting-planner.md | 2 + docs/post-verification.md | 4 +- docs/windows-acceptance.md | 2 +- scripts/windows-acceptance.json | 34 +- 17 files changed, 268 insertions(+), 1829 deletions(-) create mode 100644 OpenNest.WinForms.Tests/Controls/ValidationOverlayTests.cs delete mode 100644 OpenNest.WinForms.Tests/Forms/CuttingPlanFormTests.cs create mode 100644 OpenNest.WinForms.Tests/Forms/CuttingUiRetirementTests.cs delete mode 100644 OpenNest.WinForms.Tests/Forms/ValidateNestFormTests.cs delete mode 100644 OpenNest/Forms/CuttingPlanForm.Designer.cs delete mode 100644 OpenNest/Forms/CuttingPlanForm.cs delete mode 100644 OpenNest/Forms/ValidateNestForm.cs diff --git a/OpenNest.WinForms.Tests/Controls/ValidationOverlayTests.cs b/OpenNest.WinForms.Tests/Controls/ValidationOverlayTests.cs new file mode 100644 index 0000000..82a9cc3 --- /dev/null +++ b/OpenNest.WinForms.Tests/Controls/ValidationOverlayTests.cs @@ -0,0 +1,47 @@ +using System.Drawing; +using OpenNest.Controls; +using OpenNest.Diagnostics; +using OpenNest.Geometry; + +namespace OpenNest.WinForms.Tests.Controls; + +public class ValidationOverlayTests +{ + [Fact] + public void RapidContactCrosshairIsDrawnAtContactAndClearedWithFinding() => RunSta(() => + { + using var view = new PlateView(); + view.ShowValidationFinding(new PostVerificationFinding(PostVerificationKind.RapidCrossing, 1, 2, 1, "crossing") + { + RapidStart = new Vector(-1, 0), + RapidEnd = new Vector(1, 0), + ContactPoints = Array.AsReadOnly(new[] { Vector.Zero }) + }); + using var bitmap = new Bitmap(120, 120); + using var graphics = Graphics.FromImage(bitmap); + graphics.TranslateTransform(60, 60); + graphics.Clear(Color.Black); + view.ValidationOverlay.Draw(graphics); + var pixel = bitmap.GetPixel(60, 65); + Assert.True(pixel.R > 150 && pixel.B > 50 && pixel.G < 100); + view.ClearValidationFinding(); + graphics.Clear(Color.Black); + view.ValidationOverlay.Draw(graphics); + Assert.Equal(Color.Black.ToArgb(), bitmap.GetPixel(60, 65).ToArgb()); + }); + + [Fact] + public void PlateSwitchClearsAnimation() => RunSta(() => + { + using var view = new PlateView(); + view.ShowValidationFinding(new PostVerificationFinding(PostVerificationKind.MissingLeadIn, 1, 1, null, "missing") + { Location = new Vector(3, 4) }); + Assert.True(view.ValidationOverlay.IsAnimating); + view.Plate = new Plate(); + Assert.False(view.ValidationOverlay.IsAnimating); + Assert.Null(view.ValidationOverlay.Finding); + }); + + private static void RunSta(System.Action action) => + StaTestThread.Run(action, TimeSpan.FromSeconds(30), "Validation overlay test timed out."); +} diff --git a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs index ef10401..2be5fb8 100644 --- a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs +++ b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs @@ -220,7 +220,20 @@ public class CuttingInspectionPanelTests Assert.False(accept.Checked); PumpUntil(() => panel.Proposal != null && !panel.IsPlanning); Assert.False(Field