test(simulator): run the layout tests apart and explain a clipped control

InputsSitOnTheSettingsTabAndBothTabsFitWithoutResizing failed once on CI
(windows-desktop, 0a2b1c64): the Settings tab's columns laid out about
84 px wider than the window had measured them, clipping the hole feed
box. The same test passed on the same runner image at 0f1e4893 and
9ea495ed, and never fails locally (alone, in the full suite, with four
xUnit threads, on hidden and visible desktops), so the only varying
input found is the other forms running on parallel test threads.

Run the class in its own non-parallel collection, and make a clipped
control's message list the tab sizes, column widths and each control's
bounds, preferred size and font, so a recurrence shows which column grew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-12-02 11:00:22 -05:00
1 parent 7938fa0de7
commit c130985c92
1 file changed
+28 -1
@@ -5,6 +5,13 @@ using OpenNest.Geometry;
namespace OpenNest.WinForms.Tests.Forms;
// The layout checks failed once on CI (Settings tab columns ~84 px wider than measured when the
// window sized itself) and passed on the same commit and runner image before and after, never
// locally. Run apart from the parallel tests so other forms on other threads cannot interfere.
[CollectionDefinition("Cut simulator layout", DisableParallelization = true)]
public class CutSimulatorLayoutCollection;
[Collection("Cut simulator layout")]
public class CutSimulatorFormTests
{
[Fact]
@@ -39,7 +46,8 @@ public class CutSimulatorFormTests
{
var bounds = page.RectangleToClient(control.RectangleToScreen(control.ClientRectangle));
Assert.True(page.ClientRectangle.Contains(bounds),
$"{control.GetType().Name} '{control.Text}' at {bounds} is clipped by the {page.Text} tab ({page.ClientRectangle}).");
$"{control.GetType().Name} '{control.Text}' at {bounds} is clipped by the {page.Text} tab ({page.ClientRectangle}).\n"
+ DescribeLayout(tabs, page));
}
}
}
@@ -94,6 +102,25 @@ public class CutSimulatorFormTests
}
});
// Everything needed to tell which column grew, and whether the measurement or the layout moved.
private static string DescribeLayout(TabControl tabs, TabPage page)
{
var content = page.Controls[0];
var lines = new List<string>
{
$"DPI {page.DeviceDpi}; tabs {tabs.Size}, minimum {tabs.MinimumSize}; content {content.Bounds}, "
+ $"preferred {content.GetPreferredSize(System.Drawing.Size.Empty)}",
};
if (content is TableLayoutPanel table)
lines.Add($"Columns: {string.Join(", ", table.GetColumnWidths())}");
foreach (Control control in content.Controls)
{
lines.Add($" {control.GetType().Name} '{control.Text}' {control.Bounds} preferred "
+ $"{control.GetPreferredSize(System.Drawing.Size.Empty)} font {control.Font.Name} {control.Font.SizeInPoints}pt");
}
return string.Join("\n", lines);
}
private static System.Drawing.Rectangle Screen(Control control) =>
control.RectangleToScreen(control.ClientRectangle);