@Test public void testGetImageObject() { AdapterFactory adapterFactoryImpl = new ProjectItemProviderAdapterFactory(); LayerItemProvider itemProvider = new LayerItemProvider(adapterFactoryImpl); AdapterFactoryLabelProvider fac = new AdapterFactoryLabelProvider(adapterFactoryImpl); Image image = null; Image image2 = null; try { layer.eAdapters().add(itemProvider); image = (Image) fac.getImage(layer); assertNotNull(image); image2 = (Image) fac.getImage(layer); assertSame(image, image2); layer .getProperties() .put(LayerItemProvider.GENERATED_ICON, Glyph.geometry(Color.RED, Color.BLACK)); image2 = (Image) fac.getImage(layer); assertNotSame(image, image2); layer .getProperties() .put(LayerItemProvider.GENERATED_ICON, Glyph.geometry(Color.GREEN, Color.BLACK)); image = (Image) fac.getImage(layer); assertNotSame(image, image2); layer.setIcon(Glyph.geometry(Color.GREEN, Color.RED)); image2 = (Image) fac.getImage(layer); assertNotSame(image, image2); layer .getProperties() .put(LayerItemProvider.GENERATED_ICON, Glyph.geometry(Color.GREEN, Color.BLUE)); image = (Image) fac.getImage(layer); assertSame(image, image2); } finally { fac.dispose(); itemProvider.dispose(); } }
/** @generated */ public void dispose() { myAdapterFactoryLabelProvider.dispose(); }