mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-03 14:41:37 -05:00
"Fill" said nothing about what the engine does, since every engine fills. It is now Lattice, and Fill stays an alias, so saved selections, scripts and API requests keep working. Engine descriptions are rewritten in plain language and shown beside each name in the desktop engine lists; the main toolbar's tooltip also says when Fill Area falls back to Lattice. Docs also cover the leftover placement from the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using OpenNest.CNC;
|
|
using OpenNest.Engine;
|
|
using OpenNest.Engine.Jobs.Placement;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.Tests.Engine;
|
|
|
|
/// <summary>
|
|
/// Callers name the placement strategy explicitly at the <see cref="PlateFillService"/>
|
|
/// boundary instead of consulting process-global selection state.
|
|
/// </summary>
|
|
public class ExplicitPlacementStrategyTests
|
|
{
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("")]
|
|
[InlineData(" ")]
|
|
public void ResolveStrategy_UnsetMeansLattice(string strategy)
|
|
{
|
|
Assert.Equal("Lattice", PlateFillService.ResolveStrategy(strategy));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("strip", "Strip")]
|
|
[InlineData("VERTICAL REMNANT", "Vertical Remnant")]
|
|
public void ResolveStrategy_ReturnsCanonicalBuiltInName(string strategy, string expected)
|
|
{
|
|
Assert.Equal(expected, PlateFillService.ResolveStrategy(strategy));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Mystery Engine")]
|
|
[InlineData("StockLadder")]
|
|
public void ResolveStrategy_RejectsUnknownStrategy(string strategy)
|
|
{
|
|
Assert.Throws<NotSupportedException>(() => PlateFillService.ResolveStrategy(strategy));
|
|
}
|
|
|
|
[Fact]
|
|
public void PlateFillService_Nest_ResolvesNamedStrategyAndRejectsUnknown()
|
|
{
|
|
var plate = new Plate(new Size(60, 80));
|
|
var drawing = TestHelpers.MakeRectDrawing(6, 4, "part");
|
|
|
|
var parts = PlateFillService.Nest(
|
|
"Vertical Remnant",
|
|
plate,
|
|
new List<NestItem> { new() { Drawing = drawing, Quantity = 4 } },
|
|
null,
|
|
CancellationToken.None
|
|
);
|
|
|
|
Assert.NotEmpty(parts);
|
|
Assert.All(parts, part => Assert.Same(drawing, part.BaseDrawing));
|
|
Assert.Empty(plate.Parts);
|
|
|
|
Assert.Throws<NotSupportedException>(() =>
|
|
PlateFillService.Nest(
|
|
"Mystery Engine",
|
|
plate,
|
|
new List<NestItem> { new() { Drawing = drawing, Quantity = 1 } },
|
|
null,
|
|
CancellationToken.None
|
|
)
|
|
);
|
|
}
|
|
}
|