Skip to content

Make Shell.setSize() test compatible with fractional scaling#3267

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:test-shell-setsize-windows
Apr 24, 2026
Merged

Make Shell.setSize() test compatible with fractional scaling#3267
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:test-shell-setsize-windows

Conversation

@HeikoKlare

Copy link
Copy Markdown
Contributor

The test case test_setSizeLorg_eclipse_swt_graphics_Point in Test_org_eclipse_swt_widgets_Shell sporadically fails in I-Builds and constantly fails when executed locally on a non-100% monitor. Due to rounding of the point-based size when converting to pixels upon setting the shell size, the value yielded by getSize() used for result validation is not necessarily equal. This change adapts the test case to apply an according tolerance value whenever the shell zoom is not 100%.

Supposed to fix this kind of failures sporadically seen in I-Build tests:

expected: <Point {792, 536}> but was: <Point {792, 535}>

org.opentest4j.AssertionFailedError: expected: <Point {792, 536}> but was: <Point {792, 535}>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1145)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Shell.test_setSizeLorg_eclipse_swt_graphics_Point(Test_org_eclipse_swt_widgets_Shell.java:817)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Suppressed: java.lang.RuntimeException: AwtScreenshot VM finished with exit code 1:
Exception in thread "main" java.awt.AWTError: no screen devices
at java.desktop/sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Win32GraphicsEnvironment.java:101)
at java.desktop/java.awt.Robot.<init>(Robot.java:135)
at org.eclipse.test.AwtScreenshot.main(AwtScreenshot.java:43)

at org.eclipse.test.AwtScreenshot.dumpAwtScreenshot(AwtScreenshot.java:113)
at org.eclipse.test.Screenshots.takeScreenshot(Screenshots.java:102)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget.lambda$1(Test_org_eclipse_swt_widgets_Widget.java:79)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget.lambda$0(Test_org_eclipse_swt_widgets_Widget.java:75)

Similar to:

The test case test_setSizeLorg_eclipse_swt_graphics_Point in
Test_org_eclipse_swt_widgets_Shell sporadically fails in I-Builds and
constantly fails when executed locally on a non-100% monitor. Due to
rounding of the point-based size when converting to pixels upon setting
the shell size, the value yielded by getSize() used for result
validation is not necessarily equal. This change adapts the test case to
apply an according tolerance value whenever the shell zoom is not 100%.
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

  182 files  ±0    182 suites  ±0   27m 33s ⏱️ + 1m 0s
4 723 tests ±0  4 700 ✅ ±0   23 💤 ±0  0 ❌ ±0 
6 812 runs  ±0  6 647 ✅ ±0  165 💤 ±0  0 ❌ ±0 

Results for commit a726779. ± Comparison against base commit aa1dbb8.

@HeikoKlare HeikoKlare marked this pull request as ready for review April 24, 2026 15:05
@HeikoKlare HeikoKlare merged commit 6ad4870 into eclipse-platform:master Apr 24, 2026
24 checks passed
@HeikoKlare HeikoKlare deleted the test-shell-setsize-windows branch April 24, 2026 18:04
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