From 6d213669aeb1e4366e66a87ee991bf3f9f0ba389 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Thu, 30 Jul 2026 21:17:39 +0200 Subject: [PATCH] Use a small fixture for tab-opening UI test The tab-opening test only verifies document tab and selection wiring. Using a tiny in-assembly fixture avoids cold framework decompilation work in CI and lowers the chance of unrelated timeout noise. Assisted-by: OpenCode:openai/gpt-5.5:OpenCode --- ILSpy.Tests/AssemblyList/AssemblyTreeTests.cs | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ILSpy.Tests/AssemblyList/AssemblyTreeTests.cs b/ILSpy.Tests/AssemblyList/AssemblyTreeTests.cs index 48230d467..01f2273b8 100644 --- a/ILSpy.Tests/AssemblyList/AssemblyTreeTests.cs +++ b/ILSpy.Tests/AssemblyList/AssemblyTreeTests.cs @@ -1252,18 +1252,19 @@ public class AssemblyTreeTests // tab opens with the supplied node decompiled, the existing tab keeps its content, // and the assembly-tree selection is pulled across to the new tab's source node // (the active tab and the tree are kept in lockstep). - var (window, vm) = await TestHarness.BootAsync(3); + var (window, vm) = await TestHarness.BootAsync(); + var testAssembly = await vm.OpenAssemblyAsync(typeof(TabOpeningFixture).Assembly.Location); var typeNode = vm.AssemblyTreeModel.FindNode( - "System.Linq", "System.Linq", "System.Linq.Enumerable"); + testAssembly.ShortName, "ICSharpCode.ILSpy.Tests", "ICSharpCode.ILSpy.Tests.TabOpeningFixture"); typeNode.IsExpanded = true; var pinned = typeNode.Children.OfType() - .Single(m => m.MethodDefinition.Name == "AsEnumerable"); + .Single(m => m.MethodDefinition.Name == nameof(TabOpeningFixture.PinnedMethod)); var newTabTarget = typeNode.Children.OfType() - .First(m => m.MethodDefinition.Name == "Empty"); + .Single(m => m.MethodDefinition.Name == nameof(TabOpeningFixture.NewTabMethod)); vm.AssemblyTreeModel.SelectNode(pinned); var firstTab = await vm.DockWorkspace.WaitForDecompiledTextAsync(); - TestCapture.Step("asenumerable-in-first-tab"); + TestCapture.Step("fixture-pinned-method-in-first-tab"); await Waiters.WaitForAsync(() => window.GetVisualDescendants().OfType().Any()); var pane = await window.WaitForComponent(); @@ -1276,11 +1277,11 @@ public class AssemblyTreeTests await Waiters.WaitForAsync( () => (documents.VisibleDockables?.Count ?? 0) > initialCount); var newTab = await vm.DockWorkspace.WaitForDecompiledTextAsync(); - TestCapture.Step("empty-spawned-in-new-tab"); + TestCapture.Step("fixture-new-tab-method-spawned-in-new-tab"); ReferenceEquals(newTab, firstTab).Should().BeFalse( "a fresh decompiler tab must be created instead of reusing the existing one"); - newTab.Text.Should().Contain("Empty"); - firstTab.Text.Should().Contain("AsEnumerable"); + newTab.Text.Should().Contain(nameof(TabOpeningFixture.NewTabMethod)); + firstTab.Text.Should().Contain(nameof(TabOpeningFixture.PinnedMethod)); // Selection has moved to the new tab's source node — the active tab and the // assembly-tree selection stay in lockstep. ReferenceEquals(vm.AssemblyTreeModel.SelectedItem, newTabTarget).Should().BeTrue( @@ -1810,3 +1811,16 @@ public class AssemblyTreeTests "freshly resolved dependencies are auto-loaded"); } } + +sealed class TabOpeningFixture +{ + public int PinnedMethod() + { + return 1; + } + + public int NewTabMethod() + { + return 2; + } +}