From c130985c9275d7a5da3ac300243408d3fd565410 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 2 Dec 2026 11:00:20 -0500 Subject: [PATCH] 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 --- .../Forms/CutSimulatorFormTests.cs | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/OpenNest.WinForms.Tests/Forms/CutSimulatorFormTests.cs b/OpenNest.WinForms.Tests/Forms/CutSimulatorFormTests.cs index 75734bab..4a9673c3 100644 --- a/OpenNest.WinForms.Tests/Forms/CutSimulatorFormTests.cs +++ b/OpenNest.WinForms.Tests/Forms/CutSimulatorFormTests.cs @@ -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 + { + $"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);