From a0d063bb94fcd375ab5ddee224628280572c4a1b Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 28 Oct 2026 22:21:50 -0400 Subject: [PATCH] test(desktop): apply the Edit Plate dialog directly in the outline tests Co-Authored-By: Claude Fable 5.1 --- .../Forms/EditPlateFormOutlineTests.cs | 10 +++++----- OpenNest/Forms/EditPlateForm.cs | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenNest.WinForms.Tests/Forms/EditPlateFormOutlineTests.cs b/OpenNest.WinForms.Tests/Forms/EditPlateFormOutlineTests.cs index 893db2af..558c3b64 100644 --- a/OpenNest.WinForms.Tests/Forms/EditPlateFormOutlineTests.cs +++ b/OpenNest.WinForms.Tests/Forms/EditPlateFormOutlineTests.cs @@ -20,7 +20,6 @@ public class EditPlateFormOutlineTests using var form = new EditPlateForm(plate); var size = (TextBox)form.Controls.Find("textBoxSize", true)[0]; var clear = (Button)form.Controls.Find("buttonClearOutline", true)[0]; - var done = (Button)form.Controls.Find("applyButton", true)[0]; Assert.False(size.ReadOnly); Assert.False(clear.Enabled); @@ -30,9 +29,9 @@ public class EditPlateFormOutlineTests Assert.True(clear.Enabled); Assert.Equal(new Size(48, 96).ToString(), form.SizeString); Assert.Contains("6 vertices", ((Label)form.Controls.Find("labelOutline", true)[0]).Text); - Assert.True(done.Enabled); + Assert.True(((Button)form.Controls.Find("applyButton", true)[0]).Enabled); - done.PerformClick(); + form.Apply(); Assert.Equal(Ell(), plate.Outline); Assert.Equal(48, plate.Size.Width); Assert.Equal(96, plate.Size.Length); @@ -46,9 +45,10 @@ public class EditPlateFormOutlineTests var size = (TextBox)form.Controls.Find("textBoxSize", true)[0]; Assert.True(size.ReadOnly); - ((Button)form.Controls.Find("buttonClearOutline", true)[0]).PerformClick(); + form.Outline = null; // what Clear does Assert.False(size.ReadOnly); - ((Button)form.Controls.Find("applyButton", true)[0]).PerformClick(); + Assert.False(((Button)form.Controls.Find("buttonClearOutline", true)[0]).Enabled); + form.Apply(); Assert.Null(plate.Outline); Assert.Equal(48, plate.Size.Width); diff --git a/OpenNest/Forms/EditPlateForm.cs b/OpenNest/Forms/EditPlateForm.cs index 6e997190..a111debe 100644 --- a/OpenNest/Forms/EditPlateForm.cs +++ b/OpenNest/Forms/EditPlateForm.cs @@ -186,6 +186,9 @@ namespace OpenNest.Forms Outline = plate.Outline; } + /// Writes the dialog's values to the plate, as Done does. + internal void Apply() => Save(); + private void Save() { // The outline carries its own size; a parsed size would drop it.