[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=393446#comment-393446 ]

brands commented on GLAZEDLISTS-594:

Still, on Mac two SWT tests fail:
ca.odell.glazedlists.swt.EventTableViewerTest and ca.odell.glazedlists.swt.DefaultEventTableViewerTest:

    [junit] java.lang.NullPointerException
    [junit]     at org.eclipse.swt.graphics.Device.getPrimaryScreen(Unknown Source)
    [junit]     at org.eclipse.swt.graphics.Device.getScreenDPI(Unknown Source)
    [junit]     at org.eclipse.swt.graphics.Device.getDPI(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.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:65)
    [junit]     at ca.odell.glazedlists.swt.SwtClassRule$1.evaluate(SwtClassRule.java:31)

They hava been disabled on Mac.

> 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