use of org.eclipse.swt.graphics.ImageLoaderEvent in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_graphics_ImageLoader method test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener.
@Test
public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() {
ImageLoader loader = new ImageLoader();
ImageLoaderListener loaderListener = e -> loaderListenerCalled = true;
try {
loader.addImageLoaderListener(null);
fail("No exception thrown for addImageLoaderListener with null argument");
} catch (IllegalArgumentException e) {
}
assertFalse(":a:", loader.hasListeners());
loader.addImageLoaderListener(loaderListener);
assertTrue(":b:", loader.hasListeners());
loaderListenerCalled = false;
try (InputStream stream = SwtTestUtil.class.getResourceAsStream("interlaced_target.png")) {
loader.load(stream);
} catch (IOException e) {
}
assertTrue(":c:", loaderListenerCalled);
loaderListenerCalled = false;
try (InputStream stream = SwtTestUtil.class.getResourceAsStream("target.png")) {
loader.load(stream);
} catch (IOException e) {
}
assertFalse(":d:", loaderListenerCalled);
loaderListenerCalled = false;
loader.notifyListeners(new ImageLoaderEvent(loader, loader.data[0], 0, true));
assertTrue(":e:", loaderListenerCalled);
loader.removeImageLoaderListener(loaderListener);
assertFalse(":f:", loader.hasListeners());
}
use of org.eclipse.swt.graphics.ImageLoaderEvent in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_graphics_ImageLoaderEvent method test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ.
@Test
public void test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ() {
try {
new ImageLoaderEvent(null, null, 0, true);
fail("No exception thrown for ImageLoader source == null");
} catch (IllegalArgumentException e) {
}
new ImageLoaderEvent(new ImageLoader(), null, 0, true);
}
use of org.eclipse.swt.graphics.ImageLoaderEvent in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_graphics_ImageLoaderEvent method test_toString.
@Test
public void test_toString() {
ImageLoaderEvent event = new ImageLoaderEvent(new ImageLoader(), null, 0, true);
assertNotNull(event.toString());
assertTrue(event.toString().length() > 0);
}
Aggregations