Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330882

Summary: SWTBotApplicationLauncherClassRunner can't use on Mac OSX Cocoa platform.
Product: [Technology] SWTBot Reporter: Hiroki Kondo <kompiro>
Component: SWTBotAssignee: Project Inbox <swtbot-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: mariot.chauvin
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
suggested source none

Description Hiroki Kondo CLA 2010-11-23 01:54:00 EST
Build Identifier: 20100917-0705

on Cocoa platform, SWT UI Thread needs to run on main thread. It is a cocoa restriction.If you use SWTBotApplicationLauncherClassRunner on Mac OSX, you'll get the follow message.

***WARNING: Display must be created on main thread due to Cocoa restrictions.
Exception in thread "Thread-2" org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Display.error(Display.java:1027)
	at org.eclipse.swt.widgets.Display.createDisplay(Display.java:794)
	at org.eclipse.swt.widgets.Display.create(Display.java:777)
	at org.eclipse.swt.graphics.Device.<init>(Device.java:130)
	at org.eclipse.swt.widgets.Display.<init>(Display.java:668)
	at org.eclipse.swt.widgets.Display.<init>(Display.java:659)
	at org.kompiro.jamcircle.scripting.ui.internal.action.MockActionRunner.startApplication(MockActionRunner.java:21)
	at org.eclipse.swtbot.swt.finder.junit.SWTBotApplicationLauncherClassRunner$1.run(SWTBotApplicationLauncherClassRunner.java:63)
	at java.lang.Thread.run(Thread.java:680)


SWTBotApplicationLauncherClassRunner creates Display on another thread.
So it can't use on cocoa platform.

Reproducible: Always
Comment 1 Hiroki Kondo CLA 2010-11-23 02:02:06 EST
Created attachment 183634 [details]
suggested source

I suggest to change point of view to think SWTBot's TestRunner like attachment source.The attached source is start on main thread, and running test on another thread.
Comment 2 Mariot Chauvin CLA 2010-11-23 05:30:17 EST
Correct me if I am wrong but this is not related to GEFBot.

This is may be related to (or a duplicate of) bug 308425.
Comment 3 Ketan Padegaonkar CLA 2011-02-22 10:39:14 EST
Marking as dup. Fixing this on cocoa is turning out to be a nightmare. Any suggestions to improve the situation are welcome. I'm myself stuck with development of swtbot on carbon 32bit.

*** This bug has been marked as a duplicate of bug 308425 ***