From e78fc451495c3c26dbccc5e85357f45a79255c80 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 29 Nov 2026 21:43:20 -0500 Subject: [PATCH] test(ui): start the grid tooltip timer the dispose test relies on DisposingAGridStopsItsShowingKeyboardToolTip expected ShowKeyboardToolTip to leave an auto-pop timer running. On Windows 11 and later keyboard tooltips are persistent and start none, and showing one hooks the form's Deactivate, which stops the timer whenever the form loses activation (it flaked on CI's Server 2022 runner). Set up the running timer explicitly; the test still fails without GridStyle's dispose hook. Co-Authored-By: Claude Opus 5.5 --- OpenNest.WinForms.Tests/Controls/GridStyleTests.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenNest.WinForms.Tests/Controls/GridStyleTests.cs b/OpenNest.WinForms.Tests/Controls/GridStyleTests.cs index b60f94b2..ca9858cd 100644 --- a/OpenNest.WinForms.Tests/Controls/GridStyleTests.cs +++ b/OpenNest.WinForms.Tests/Controls/GridStyleTests.cs @@ -94,10 +94,17 @@ public class GridStyleTests form.Show(); Pump(grid); - // As when the keyboard moves to a cell in the embedded version history. + // As when the keyboard moves to a cell in the embedded version history. On Windows 11 + // and later a keyboard tooltip is persistent and starts no timer, so make it behave as + // it does on earlier Windows, where the timer exists. var toolTip = (ToolTip)typeof(DataGridView).GetProperty("KeyboardToolTip", members).GetValue(grid); + typeof(ToolTip).GetProperty("IsPersistent", members).SetValue(toolTip, false); typeof(ToolTip).GetMethod("ShowKeyboardToolTip", members) .Invoke(toolTip, new object[] { "2", grid.Rows[0].Cells[0], 3000 }); + // Showing hooks the form's Deactivate, which hides the tip and stops its timer; losing + // activation to another window (a parallel test's form) is not the case under test, so + // make sure the auto-pop timer is running before the grid goes. + typeof(ToolTip).GetMethod("StartTimer", members).Invoke(toolTip, new object[] { grid, 3000 }); var timer = typeof(ToolTip).GetField("_timer", members); Assert.NotNull(timer.GetValue(toolTip));