Skip to content

Commit 39242ae

Browse files
Fixes
1 parent 40c087f commit 39242ae

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,9 @@ public void test_bug1288_createGCFromImageFromNonDisplayThread() throws Interrup
825825
AtomicReference<Exception> exceptionReference = new AtomicReference<>();
826826
Thread thread = new Thread(() -> {
827827
try {
828-
Image image = new Image(null, (gc, width, height) -> {}, 100, 100);
828+
Image image = new Image(null, 100, 100);
829+
GC gc = new GC(image);
830+
gc.dispose();
829831
image.dispose();
830832
} catch(Exception e) {
831833
exceptionReference.set(e);

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,22 @@ public void setUp() {
101101

102102
@Test
103103
public void test_ConstructorLorg_eclipse_swt_graphics_DeviceII() {
104-
IllegalArgumentException e1 = assertThrows(IllegalArgumentException.class, () -> new Image(display, (gc, width, height) -> {}, -1, 10));
104+
IllegalArgumentException e1 = assertThrows(IllegalArgumentException.class, () -> new Image(display, -1, 10));
105105
assertSWTProblem("Incorrect exception thrown for width < 0", SWT.ERROR_INVALID_ARGUMENT, e1);
106106

107-
IllegalArgumentException e2 = assertThrows(IllegalArgumentException.class, () -> new Image(display, (gc, width, height) -> {}, 0, 10));
107+
IllegalArgumentException e2 = assertThrows(IllegalArgumentException.class, () -> new Image(display, 0, 10));
108108
assertSWTProblem("Incorrect exception thrown for width == 0", SWT.ERROR_INVALID_ARGUMENT, e2);
109109

110-
IllegalArgumentException e3 = assertThrows(IllegalArgumentException.class, () -> new Image(display, (gc, width, height) -> {}, 10, -20));
110+
IllegalArgumentException e3 = assertThrows(IllegalArgumentException.class, () -> new Image(display, 10, -20));
111111
assertSWTProblem("Incorrect exception thrown for height < 0", SWT.ERROR_INVALID_ARGUMENT, e3);
112112

113-
IllegalArgumentException e4 = assertThrows(IllegalArgumentException.class, () -> new Image(display, (gc, width, height) -> {}, 10, 0));
113+
IllegalArgumentException e4 = assertThrows(IllegalArgumentException.class, () -> new Image(display, 10, 0));
114114
assertSWTProblem("Incorrect exception thrown for height == 0", SWT.ERROR_INVALID_ARGUMENT, e4);
115115

116-
Image image = new Image(null, (gc, width, height) -> {}, 10, 10);
116+
Image image = new Image(null, 10, 10);
117117
image.dispose();
118118

119-
image = new Image(display, (gc, width, height) -> {}, 10, 10);
119+
image = new Image(display, 10, 10);
120120
image.dispose();
121121
}
122122

@@ -563,12 +563,12 @@ public void test_getBounds() {
563563

564564
Image image;
565565
// creates bitmap image
566-
image = new Image(display, bounds.width, bounds.height);
566+
image = new Image(display, (gc, width, height) -> {}, bounds.width, bounds.height);
567567
Rectangle bounds1 = image.getBounds();
568568
image.dispose();
569569
assertEquals(bounds, bounds1);
570570

571-
image = new Image(display, bounds.width, bounds.height);
571+
image = new Image(display, (gc, width, height) -> {}, bounds.width, bounds.height);
572572
bounds1 = image.getBounds();
573573
image.dispose();
574574
assertEquals(bounds, bounds1);

0 commit comments

Comments
 (0)