Files
OpenNest/OpenNest.WinForms.Tests/Controls/CuttingPanelTests.cs
T
ajandClaude Opus 5.5 41460481d6 fix(cutting): keep Plan Cutting's lead and tab edits
Plan Cutting saved its settings only on a successful Apply, so a plate
that would not plan lost them. Each open then laid the machine's leads
back over the last parameters, and the cutting panel rebuilt parameters
from scratch, dropping kerf and the machine/material/thickness stamp.

Save the settings when the dialog is accepted, keep the panel's
unexposed fields, and only apply the machine's leads when the last
parameters were not already taken from that machine, material, grade
and thickness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:58:14 -04:00

40 lines
1.4 KiB
C#

using OpenNest.CNC.CuttingStrategy;
using OpenNest.Controls;
namespace OpenNest.WinForms.Tests.Controls;
public class CuttingPanelTests
{
[Fact]
public void BuildParameters_KeepsTheSettingsThePanelHasNoFieldFor()
{
StaTestThread.Run(() =>
{
using var panel = new CuttingPanel();
panel.LoadFromParameters(new CuttingParameters
{
MachineName = "CL-980",
MaterialName = "Stainless Steel",
Grade = "304",
Thickness = 0.075,
Kerf = 0.008,
ExternalLeadIn = new ArcLeadIn { Radius = 0.0625 },
ExternalLeadOut = new NoLeadOut(),
TabsEnabled = true,
TabConfig = new NormalTab { Size = 0.25 },
});
var built = panel.BuildParameters();
// Without the stamp, the machine's leads would replace these edits on the next open.
Assert.Equal("CL-980", built.MachineName);
Assert.Equal("Stainless Steel", built.MaterialName);
Assert.Equal("304", built.Grade);
Assert.Equal(0.075, built.Thickness);
Assert.Equal(0.008, built.Kerf);
Assert.IsType<NoLeadOut>(built.ExternalLeadOut);
Assert.True(built.TabsEnabled);
}, TimeSpan.FromSeconds(30), "The cutting panel did not build its parameters.");
}
}