Files
OpenNest/OpenNest.WinForms.Tests/Forms/SetValueFormTests.cs
T
ajandClaude Opus 5.5 d98bee87ec feat(nudge): step the selection by a calculated distance
Set Offset Increment gains a "Calculated distance" option. With it on, the
arrow keys move the selection by its own size plus the part spacing,
measured on its geometry like a fill's copy distance, so it lands tight
without a push back. The move stops early at an edge, clamp or part, and a
clone preview steps clear of the copy just placed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:21:56 -05:00

44 lines
1.5 KiB
C#

using System.Windows.Forms;
using OpenNest.Forms;
using static OpenNest.WinForms.Tests.FormTesting;
namespace OpenNest.WinForms.Tests.Forms;
public class SetValueFormTests
{
[Fact]
public void OptionShowsACheckBoxThatDisablesTheValue() => StaTestThread.Run(() =>
{
using var form = new SetValueForm { ShowInTaskbar = false };
var bare = form.ClientSize;
var option = Assert.Single(All<CheckBox>(form));
var value = Assert.Single(All<OpenNest.Controls.NumericUpDown>(form));
form.OptionText = "Calculated distance (selection size + part spacing)";
form.OptionText = "Calculated distance (selection size + part spacing)"; // Grows once.
form.OptionChecked = true;
form.Show();
Assert.True(option.Visible);
Assert.True(form.ClientSize.Height > bare.Height);
Assert.True(option.Bottom <= form.ClientSize.Height);
Assert.True(option.Right <= form.ClientSize.Width);
Assert.False(value.Enabled);
form.OptionChecked = false;
Assert.True(value.Enabled);
}, TimeSpan.FromMinutes(1), "The STA test did not complete.");
[Fact]
public void WithoutAnOptionTheDialogKeepsItsSize() => StaTestThread.Run(() =>
{
using var form = new SetValueForm();
var bare = form.ClientSize;
form.OptionText = "shown";
form.OptionText = "";
Assert.Equal(bare, form.ClientSize);
}, TimeSpan.FromMinutes(1), "The STA test did not complete.");
}