feat(engine): add built-in Rectangles and Irregular nesting engines
Moves the two production plug-in engines into OpenNest.Engine under names that describe the jobs they suit: - Rectangles: plain and near-rectangular plates, maximal-rectangles box packing (was the RectanglesNestingEngine plug-in) - Irregular: irregular profiles, no-fit-polygon frontier packing (was the Opus55NestingEngine plug-in) Their tests and the shared engine contract/layout test kit move into OpenNest.Engine.Tests/NestingEngines. The registry maps the old plug-in names to the new engines, so saved desktop selections, scripts and API requests keep working, and a leftover plug-in DLL under an old name cannot shadow its replacement. Desktop startup passes the registry's lookup when restoring the saved Auto Nest engine.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Xunit;
|
||||
using OpenNest.Engine.Jobs;
|
||||
using Xunit;
|
||||
|
||||
namespace OpenNest.Engine.Tests.Jobs;
|
||||
|
||||
@@ -10,12 +10,45 @@ public class NestingEngineRegistryTests
|
||||
{
|
||||
var names = NestingEngineRegistry.AvailableEngines.Select(e => e.Name).ToList();
|
||||
|
||||
Assert.Contains("Rectangles", names);
|
||||
Assert.Contains("Irregular", names);
|
||||
Assert.Contains("Default", names);
|
||||
Assert.Contains("Strip", names);
|
||||
Assert.Contains("Vertical Remnant", names);
|
||||
Assert.Contains("Horizontal Remnant", names);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RenamedPlugInNamesResolveToTheirBuiltInReplacements()
|
||||
{
|
||||
Assert.Equal("Irregular", NestingEngineRegistry.ResolveName("Opus55NestingEngine"));
|
||||
Assert.Equal("Rectangles", NestingEngineRegistry.ResolveName("rectanglesnestingengine"));
|
||||
Assert.Equal("Rectangles", NestingEngineRegistry.ResolveName(" rectangles "));
|
||||
Assert.IsType<OpenNest.Engine.NestingEngines.Irregular.IrregularNestingEngine>(
|
||||
NestingEngineRegistry.Create("Opus55NestingEngine"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RetiredEnginesAreNotSilentlyAliased()
|
||||
{
|
||||
Assert.Null(NestingEngineRegistry.ResolveName("Gpt6AstraNestingEngine"));
|
||||
Assert.Null(NestingEngineRegistry.ResolveName("Qwen38FlashNextNestingEngine"));
|
||||
Assert.Null(NestingEngineRegistry.ResolveName(" "));
|
||||
Assert.Throws<NotSupportedException>(() => NestingEngineRegistry.Create("Qwen38FlashNextNestingEngine"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LeftoverPlugInUnderARenamedNameCannotShadowItsReplacement()
|
||||
{
|
||||
var before = NestingEngineRegistry.AvailableEngines.Count;
|
||||
|
||||
NestingEngineRegistry.Register("Opus55NestingEngine", "stale plug-in",
|
||||
() => new FixedStrategyNestingEngine("Default"));
|
||||
|
||||
Assert.Equal(before, NestingEngineRegistry.AvailableEngines.Count);
|
||||
Assert.Equal("Irregular", NestingEngineRegistry.ResolveName("Opus55NestingEngine"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EachBuiltInFactoryProducesAWorkingEngine()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user