Skip to content

Commit abbe191

Browse files
committed
Adapt placement test in StatusDialogManagerTest for fractional scaling
The StatusDialogManagerTest.testBug275867() sporadically fails on Windows because of off-by-one errors between the expected and actual location of the shell, probably caused by rounding on fractional monitor zooms. To be more resilient against slight offsets in the position of the shell, this change adds a tolerance to the position validation. It also adds some more debug information to the failure description. Fixes #3717
1 parent 676351a commit abbe191

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/StatusDialogManagerTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,16 @@ public void testBug275867(){
774774
wsdm.addStatusAdapter(statusAdapter, false);
775775
assertNotNull(StatusDialogUtil.getStatusShell());
776776
Shell shell = StatusDialogUtil.getStatusShell();
777-
assertEquals("Dialog is not centered correctly",getInitialLocation(shell), shell.getLocation());
777+
778+
Point expected = getInitialLocation(shell);
779+
Point actual = shell.getLocation();
780+
int tolerance = 1;
781+
assertTrue("Dialog is not centered correctly" //
782+
+ " (expected location: " + expected + " ± " + tolerance //
783+
+ ", actual location: " + actual //
784+
+ ", dialog bounds: " + shell.getBounds() //
785+
+ ", parent bounds: " + shell.getParent().getBounds() + ")",
786+
Math.abs(expected.x - actual.x) <= tolerance && Math.abs(expected.y - actual.y) <= tolerance);
778787
}
779788

780789
//error link present

0 commit comments

Comments
 (0)