event.character = (char) -1; event.keyCode = -1; assertFalse(display.post(event));
assertTrue(display.post(event));
public void test_postLorg_eclipse_swt_widgets_Event() {	final int KEYCODE = SWT.SHIFT;		Display display = new Display();	try {		try {			display.post(null);			fail("No exception thrown for post with null argument");		} catch (IllegalArgumentException e) {			assertEquals("Incorrect exception thrown for post with null argument", SWT.ERROR_NULL_ARGUMENT, e);		}				Shell shell = new Shell(display, SWT.NO_TRIM);		shell.setBounds(display.getBounds());		shell.open();		Event event;				// Test key events (down/up)		event = new Event();		event.type = SWT.KeyDown;		event.character = (char) -1;  	// bogus character		assertFalse(display.post(event));		// don't test KeyDown/KeyUp with a character to avoid sending to 		// random window if test shell looses focus				event = new Event();		event.type = SWT.KeyUp;		event.character = (char) -1;  	// bogus character		event.keyCode = -1;  			// bogus keyCode		assertFalse(display.post(event));		event.type = SWT.KeyDown;		event.keyCode = KEYCODE;		shell.setFocus();		assertTrue(display.post(event));		event.type = SWT.KeyUp;		shell.setFocus();		assertTrue(display.post(event));				// Test mouse events (down/up/move)		event = new Event();		event.type = SWT.MouseMove;		event.x = 0;		event.y = 0;		shell.setFocus();		assertTrue(display.post(event));				event = new Event();		event.type = SWT.MouseDown;		assertFalse(display.post(event));  // missing button		event.button = 1;		shell.setFocus();		assertTrue(display.post(event));				event = new Event();		event.type = SWT.MouseUp;		assertFalse(display.post(event));  // missing button		event.button = 1;		shell.setFocus();		assertTrue(display.post(event));				// Test unsupported event		event = new Event();		event.type = SWT.MouseDoubleClick;		assertFalse(display.post(event));				shell.dispose();				// can't verify that the events were actually sent to a listener.		// the test shell won't receive any events if it has lost focus, 		// e.g., due to user intervention or another process popping up 		// a window. 	} finally {		display.dispose();	}}