Skip to content

Commit ac7a11d

Browse files
Fixes
1 parent 8941cb4 commit ac7a11d

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
@@ -100,22 +100,22 @@ public void setUp() {
100100

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

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

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

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

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

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

@@ -545,12 +545,12 @@ public void test_getBounds() {
545545

546546
Image image;
547547
// creates bitmap image
548-
image = new Image(display, bounds.width, bounds.height);
548+
image = new Image(display, (gc, width, height) -> {}, bounds.width, bounds.height);
549549
Rectangle bounds1 = image.getBounds();
550550
image.dispose();
551551
assertEquals(bounds, bounds1);
552552

553-
image = new Image(display, bounds.width, bounds.height);
553+
image = new Image(display, (gc, width, height) -> {}, bounds.width, bounds.height);
554554
bounds1 = image.getBounds();
555555
image.dispose();
556556
assertEquals(bounds, bounds1);

0 commit comments

Comments
 (0)