Fixes #5356. Add tab fan-out layout/draw diagnostic tests#5364
Conversation
Adds TabsFanOutDiagnosticTests with seven parallelizable tests that observe SubViewsLaidOut, DrawComplete, ClearedViewport, DrawingContent, and FrameChanged events per tab to measure layout/draw fan-out when an active TextView inside Tabs scrolls. Captures the current gui-cs#4973 behavior so that future fixes can be verified and silent regressions caught: - Active tab vs. inactive tab layout work - Active tab vs. inactive tab draw work (DrawComplete, ClearedViewport, DrawingContent) - A comparable single-TextView baseline vs. tabbed scenario fan-out ratio - ViewportSettings.Transparent does not mask the diagnostic - Shadow margin does not mask active-tab activity - IOutput-level output (not Driver.Contents) is observed - Layout and draw counters reported separately so regressions can be localized to one pipeline The tests are instrumentation-only and do not change rendering or invalidation semantics.
TextView is being deprecated in favor of Code (read-only) and Editor
(editable). The fan-out behavior lives in the View base class layout/draw
pipeline, so any scrollable view inside Tabs reproduces it — swap to Code
so the diagnostic survives the deprecation.
Adjusts assertions to use only widget-agnostic signals (DrawComplete on
each tab, ClearedViewport on the Tabs container). Code overrides
OnClearingViewport/OnDrawingContent and returns true, which suppresses
the ClearedViewport/DrawingContent events on the Code instances. The
per-Code data is still reported but no longer asserted at that level.
Adds Tests/IntegrationTests/TabsFanOutIntegrationTests.cs that drives
the active tab via a real Key.PageDown through the input processor →
command dispatch → main-loop LayoutAndDraw path (rather than mutating
Viewport directly). Runs against all registered drivers. Confirms the
fan-out is observable end-to-end:
Driver: <each>
Active tab Viewport.Y after 3 PageDowns: 3
Tabs 3 3 3
Code1 (active) 3 3 0
Code2-4 (inact) 3 3 0
Sum inactive DrawComplete = 9
|
Updated this PR to:
End-to-end result (per driver): 7 unit tests + 3 integration tests, all green. 102 existing tab tests still pass. |
There was a problem hiding this comment.
Pull request overview
Adds diagnostic (instrumentation-only) tests that quantify the current tabbed layout/draw “fan-out” behavior (issue #4973) so it’s observable and regression-detectable, including an end-to-end integration variant driven through real input/command dispatch.
Changes:
- Adds
TabsFanOutDiagnosticTests(unit tests) that attach per-view counters to layout/draw-related events and report them viaITestOutputHelper. - Adds
TabsFanOutIntegrationTests(integration) that exercises the same fan-out via realKey.PageDowninjection through the main-loop pipeline.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Tests/UnitTestsParallelizable/Views/TabView/TabsFanOutDiagnosticTests.cs | New unit-level diagnostic tests and counter/reporting helper for per-tab layout/draw fan-out. |
| Tests/IntegrationTests/TabsFanOutIntegrationTests.cs | New integration test validating fan-out via real input → command dispatch → main-loop layout/draw path across drivers. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
TabsFanOutDiagnosticTests(7 parallelizable tests) that count layout and draw activity per tab viaSubViewsLaidOut,DrawComplete,ClearedViewport,DrawingContent, andFrameChangedevents.Implements the acceptance criteria from #5356:
DrawComplete,ClearedViewport,DrawingContent)ViewportSettings.Transparentedge case (inactive tabs marked transparent)ShadowStyle = Opaque)IOutput-level check viadriver.GetOutput().GetLastOutput()— not relying solely onDriver.ContentsEach test emits a per-view counter table via
ITestOutputHelperso the data is visible in CI logs even when the test passes. Assertions encode the current (buggy) behavior with comments indicating which assertions need to flip once #4973 is fixed.Split from #4973.
Test plan
dotnet build Tests/UnitTestsParallelizable/UnitTests.Parallelizable.csprojsucceedsdotnet test --no-build -- --filter-method "*TabsFanOutDiagnostic*"— 7 passeddotnet test --no-build -- --filter-method "*TabsTests*" "*TabsScrollingTests*" "*TabsFanOutDiagnostic*"— 102 passed (no regressions in surrounding Tab tests)Related
NeedsLayoutis buggy #4522