Skip to content

Dispose the display of the test thread after each test class - #3873

Draft
HeikoKlare wants to merge 2 commits into
eclipse-platform:masterfrom
HeikoKlare:display-lifecycle-extension
Draft

HeikoKlare wants to merge 2 commits into
eclipse-platform:masterfrom
HeikoKlare:display-lifecycle-extension

Conversation

@HeikoKlare

@HeikoKlare HeikoKlare commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

This PR is based on #3878 and contains its commit, so only the last commit belongs to this PR. #3878 needs to be merged first: it fixes a GTK3 bug in the size of new shells, which this PR exposes because every test class now starts with a new display.

Problem

The test classes of a suite share one test thread, and a display stays associated with the thread that created it until it is disposed. A class that leaves the default display behind therefore affects every class that runs after it. A class that creates its own display then fails with an invalid thread access, and the failure points at that class instead of the one that left the display behind. Whether the suite passes depends on the order of its classes.

Solution

A new JUnit extension disposes the display after all tests of a class, so every class starts on a thread without a display. It also fails any test that leaves shells open, so the test that leaks is the one that gets reported. The display stays alive for all tests of a class, because creating a new display for every test disturbs the focus that the keyboard and drag-and-drop tests rely on.

JUnit registers the extension for every test class of the bundle by automatic extension detection, so new test classes get it without further effort. Tests that disposed the display only to clean up no longer do so.

This follows #3870, which fixed the shells that tests left open.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 102 files  ±0   1 102 suites  ±0   1h 29m 30s ⏱️ - 10m 6s
 5 232 tests +1   5 204 ✅ +1     28 💤 ±0  0 ❌ ±0 
30 940 runs  +6  27 708 ✅ +6  3 232 💤 ±0  0 ❌ ±0 

Results for commit 74f9ca3. ± Comparison against base commit 16080ee.

♻️ This comment has been updated with latest results.

@HeikoKlare
HeikoKlare force-pushed the display-lifecycle-extension branch from a0c2706 to d3c4177 Compare November 19, 2026 16:01
When a shell opens, adjustTrim derives the trim from the difference
between the frame extents and the allocation of the window, and stores
it on the display for all later shells. The allocation can still be the
one from before the window was resized, so the shell measures a trim
that does not exist and every later shell reports a size that is off by
it. For example, a shell opened with 300x200 reports a width of 400.

Use the current size of the window instead.

This was hidden in the test suite as long as an earlier test had opened
a shell with a trim above the maximum, which disables learning the trim
for the rest of the lifetime of the display. The new test therefore
opens its shells on a new display.

Assisted-by: Claude Opus 5.5 <[email protected]>
The test classes of a suite share the test thread, and a display stays
associated with the thread that created it until it is disposed. A class
that leaves the default display behind therefore influences all classes
that run after it. For example, a class that creates its own display
fails with an invalid thread access, and the failure points at that class
instead of the one that left the display behind.

The new DisplayLifecycleExtension disposes the display after all tests of
a class and fails a test that leaves shells open. It keeps the display for
all tests of a class, as recreating it for every test disturbs the focus
that keyboard and drag-and-drop tests rely on.

JUnit registers the extension for every test class of the bundle by
automatic extension detection, so new test classes get it without further
effort. Tests that disposed the display only to clean up no longer do so.

Assisted-by: Claude Opus 5.5 <[email protected]>
@HeikoKlare
HeikoKlare force-pushed the display-lifecycle-extension branch from d3c4177 to 74f9ca3 Compare November 19, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant