try { Printer printer = new Printer(); GC gc1 = new GC(printer, SWT.RIGHT_TO_LEFT); GC gc2 = new GC(printer, SWT.LEFT_TO_RIGHT); gc1.dispose(); gc2.dispose(); printer.dispose(); fail("No exception thrown for more than one GC on one printer"); } catch (IllegalArgumentException e) { assertEquals("Incorrect exception thrown for more than one GC on one printer", SWT.ERROR_INVALID_ARGUMENT, e); }
public void test_ConstructorLorg_eclipse_swt_graphics_DrawableI() {	try {		GC gc = new GC(null, SWT.LEFT_TO_RIGHT);		gc.dispose();		fail("No exception thrown for drawable == null");	} catch (IllegalArgumentException e) {		assertEquals("Incorrect exception thrown for drawable == null", SWT.ERROR_NULL_ARGUMENT, e);	}	try {		Image image = new Image(display, 10, 10);		GC gc1 = new GC(image, SWT.RIGHT_TO_LEFT);		GC gc2 = new GC(image, SWT.LEFT_TO_RIGHT);		gc1.dispose();		gc2.dispose();		image.dispose();		fail("No exception thrown for more than one GC on one image");	} catch (IllegalArgumentException e) {		assertEquals("Incorrect exception thrown for more than one GC on one image", SWT.ERROR_INVALID_ARGUMENT, e);	}	try {		Printer printer = new Printer();		GC gc1 = new GC(printer, SWT.RIGHT_TO_LEFT);		GC gc2 = new GC(printer, SWT.LEFT_TO_RIGHT);		gc1.dispose();		gc2.dispose();		printer.dispose();		fail("No exception thrown for more than one GC on one printer");	} catch (IllegalArgumentException e) {		assertEquals("Incorrect exception thrown for more than one GC on one printer", SWT.ERROR_INVALID_ARGUMENT, e);	}	Canvas canvas = new Canvas(shell, SWT.NULL);	GC testGC = new GC(canvas, SWT.RIGHT_TO_LEFT);	testGC.dispose();	testGC = new GC(canvas, SWT.LEFT_TO_RIGHT);	testGC.dispose();}