Files
OpenNest/OpenNest.WinForms.Tests/CuttingStrategy/CuttingParametersSerializerTests.cs
T
ajandClaude Opus 5.5 8c7dc41ce8 feat(planning): warn about tipping parts and retire legacy lead-in assignment
Plan Cutting is now the only automatic lead-in assignment, and parts the
support grid cannot hold level are reported wherever they lack a
steadying tab.

- Remove Assign Lead-ins (plate and nest), LeadInAssigner, the lead-in
  tool's Auto-Assign button and the Auto Tab size range; old settings
  with autoTab sizes still load
- Manual Place Lead-in tabs the clicked entry when support tabs are on
  and the grid cannot hold the part (SupportTabSettings)
- New PartSupport finding: Plan Cutting replay and best-effort plans
  warn when a drawing pin, a lead-in that does not fit or no single tab
  leaves a part unsteady; the pre-post review checks each placed
  program's outside tab gap. These warnings replace the advisory
  weak-tab notes; only the inside-corner tab note stays advisory, and
  never for a pin
- Pinned perimeters keep their pin but carry the support analysis
- Draw grid points as pixel-snapped squares without anti-aliasing
- Post fixtures build lead-ins through a test-only TestLeadIns helper
- Docs: support tabs, pre-post verification and planner notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 23:54:40 -04:00

37 lines
1.3 KiB
C#

using OpenNest.CNC.CuttingStrategy;
using OpenNest.Forms;
namespace OpenNest.Tests.CuttingStrategy;
public class CuttingParametersSerializerTests
{
[Fact]
public void RoundTrip_PreservesSupportTabs()
{
var original = new CuttingParameters
{
SupportTabs = true,
ExternalLeadIn = new LineLeadIn { Length = 0.25, ApproachAngle = 90 },
};
var json = CuttingParametersSerializer.Serialize(original);
var restored = CuttingParametersSerializer.Deserialize(json);
Assert.True(restored.SupportTabs);
}
[Fact]
public void Deserialize_RetiredAutoTabFields_AreIgnored()
{
// Settings saved before Auto Tab was removed still load; its sizes are dropped.
var json =
"{\"externalLeadIn\":{\"type\":\"None\"},\"externalLeadOut\":{\"type\":\"None\"},\"internalLeadIn\":{\"type\":\"None\"},\"internalLeadOut\":{\"type\":\"None\"},\"arcCircleLeadIn\":{\"type\":\"None\"},\"arcCircleLeadOut\":{\"type\":\"None\"},\"tabsEnabled\":false,\"tabWidth\":0.25,\"pierceClearance\":0.0625,\"autoTabMinSize\":0.5,\"autoTabMaxSize\":3.0}";
var restored = CuttingParametersSerializer.Deserialize(json);
Assert.False(restored.TabsEnabled);
Assert.False(restored.SupportTabs);
Assert.Equal(0.0625, restored.PierceClearance);
}
}