Skip to content

Add tests for retrieving styled fonts from FontRegistry in non-UI threads - #4277

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:fontregistry-nonui-thread-font-tests
Aug 24, 2026
Merged

Add tests for retrieving styled fonts from FontRegistry in non-UI threads#4277
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:fontregistry-nonui-thread-font-tests

Conversation

@HeikoKlare

Copy link
Copy Markdown
Contributor

FontRegistry supports retrieving a font from a thread that has no Display of its own, falling back to the default font instead of failing. That fallback is covered by a test for get(), but not for getBold() and getItalic(), whose variants still have to be realized when they are requested.

These tests close that gap. They pass on master — they document existing behaviour rather than change it.

🤖 Generated with Claude Code

…eads

FontRegistry supports retrieving a font from a thread that has no
Display of its own: rather than failing, it falls back to the default
font already realized on the registry's own display. That fallback is
only covered by tests for the plain font, not for the bold and italic
variants, which still have to be realized when they are requested.

Add tests pinning that such a caller still gets a font in the requested
style, and that the style is realized on the display the fallback font
belongs to rather than on an arbitrary one.

The latter matters because creating a Font without a device does not
fail: SWT substitutes Display.getDefault(). With a single display that
happens to be correct, with more than one it need not be, and a styled
font can end up on a different display than the record holding it.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   858 files  ±0     858 suites  ±0   50m 56s ⏱️ - 1m 50s
 8 174 tests +2   7 931 ✅ +2  243 💤 ±0  0 ❌ ±0 
20 424 runs  +6  19 768 ✅ +6  656 💤 ±0  0 ❌ ±0 

Results for commit 0b62b8b. ± Comparison against base commit 7cc26a1.

@HeikoKlare

Copy link
Copy Markdown
Contributor Author

Just test extensions, thus merging even though we are effectively in freeze period.

@HeikoKlare
HeikoKlare merged commit f0ef795 into eclipse-platform:master Aug 24, 2026
18 checks passed
@HeikoKlare
HeikoKlare deleted the fontregistry-nonui-thread-font-tests branch August 24, 2026 18:15
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