Bug 506680 - Test_org_eclipse_swt_widgets_Display.test_getActiveShell fails on Mac OS X
Summary: Test_org_eclipse_swt_widgets_Display.test_getActiveShell fails on Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.7   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 4.7 M4   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-28 04:12 EDT by Arun Thondapu CLA
Modified: 2016-10-31 10:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arun Thondapu CLA 2016-10-28 04:12:26 EDT
Test_org_eclipse_swt_widgets_Display.test_getActiveShell() fails with the following stack trace in recent builds (M3 candidate [1] for example)

expected same:<Shell {test_getActiveShell}> was not:<null>

java.lang.AssertionError: expected same:<Shell {test_getActiveShell}> was not:<null>
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Display.test_getActiveShell(Test_org_eclipse_swt_widgets_Display.java:223)
at org.eclipse.test.TracingSuite.runChild(TracingSuite.java:265)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:754)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:351)
at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:37)
at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:33)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
at org.eclipse.core.launcher.Main.main(Main.java:34)

[1] http://download.eclipse.org/eclipse/downloads/drops4/I20161027-0700/testresults/html/org.eclipse.swt.tests_ep47I-unit-mac64_macosx.cocoa.x86_64_8.0.html
Comment 1 Arun Thondapu CLA 2016-10-28 04:15:02 EDT
FWIW I cannot reproduce this test failure locally with the latest master on Mac OS X 10.11.
Comment 2 Eclipse Genie CLA 2016-10-31 10:06:59 EDT
New Gerrit change created: https://git.eclipse.org/r/84233
Comment 4 Markus Keller CLA 2016-10-31 10:40:00 EDT
The test does fail for me on macOS 10.12.1.

Looks like the window manager opens the shell asynchronously and getActiveShell() only returns the opened shell after some delay. I didn't find an API on Shell that would guarantee that the shell becomes active immediately. They all say something like "asks the window manager to make the shell active".

When running the test as part of the suite, a delay of 100ms was enough on my system, but when running the test individually, it needed at least 150ms. Added this delay to the test.

The test was already disabled on GTK, probably for the same reason. Re-enabled it on GTK as well.