[JIRA] (GLAZEDLISTS-594) Fix broken GUI-related tests after move to JUnit 4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[JIRA] (GLAZEDLISTS-594) Fix broken GUI-related tests after move to JUnit 4

JIRA jira-no-reply@java.net

    [ https://java.net/jira/browse/GLAZEDLISTS-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=393382#comment-393382 ]

brands commented on GLAZEDLISTS-594:

The other problem you might get running SWT tests in an headless environment like a CI server is this:

No more handles [gtk_init_check() failed]
    [junit] at org.eclipse.swt.SWT.error(Unknown Source)
    [junit] at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
    [junit] at org.eclipse.swt.widgets.Display.create(Unknown Source)
    [junit] at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    [junit] at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    [junit] at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    [junit] at org.eclipse.swt.widgets.Display.getDefault(Unknown Source)
    [junit] at ca.odell.glazedlists.swt.SwtClassRule$SwtHelper.init(SwtClassRule.java:112)
    [junit] at ca.odell.glazedlists.swt.SwtClassRule$1.evaluate(SwtClassRule.java:33)

There is no appropriate display to work with for SWT.

Here is a possible solution for Travis CI:

> Fix broken GUI-related tests after move to JUnit 4
> --------------------------------------------------
>                 Key: GLAZEDLISTS-594
>                 URL: https://java.net/jira/browse/GLAZEDLISTS-594
>             Project: glazedlists
>          Issue Type: Bug
>          Components: swt
>    Affects Versions: 1.9.1
>            Reporter: brands
>            Assignee: brands
>             Fix For: 1.10.0
> After the move to JUnit 4 GUI-related testing support for Swing and SWT was refactored to use JUnit rules.
> Those rules ensure that all test methods of a GUI test class are run on the GUI thread of the corresponding toolkit (Swing or SWT).
> For the SWT case, a dedicated, separate thread was picked in the SWT rules as GUI thread. This turned out to be a problem on other platforms such as MacOs. At least on Mac it' seems to be a requirement for the GUI thread to be the main thread. Also, VM argument "-XstartOnFirstThread" seems to be required on Mac.
> So this fix will include the following:
> - create the SWT stuff (display, shell) on the main thread
> - rename @ExecuteOnMainThread to something like @ExecuteOnNonUIThread
> - run  SWT @ExecuteOnNonUIThread tests on a thread different to the main thread (= SWT display thread)
> - ignore SWT tests on Mac that create a custom display on a different thread
> - in the ANT build add the -XstartOnFirstThread flag when executing unit tests on Mac

This message was sent by Atlassian JIRA