Skip to content

Commit db2adff

Browse files
ptzieglerHeikoKlare
authored andcommitted
Restore and modernize GC.setClipping() tests
These tests were disabled with 991d280 due to sporadic failures on Windows XP. Given that this operating system is no longer supported and given that this was over 20 years ago, a lot might have changed and the reason those tests were failing might no longer apply.
1 parent 950fd8c commit db2adff

1 file changed

Lines changed: 16 additions & 31 deletions

File tree

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

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2016 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,6 +16,7 @@
1616

1717
import static org.eclipse.swt.internal.DPIUtil.pointToPixel;
1818
import static org.eclipse.swt.tests.junit.SwtTestUtil.assertSWTProblem;
19+
import static org.junit.jupiter.api.Assertions.assertAll;
1920
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
2021
import static org.junit.jupiter.api.Assertions.assertEquals;
2122
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -793,40 +794,24 @@ public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
793794

794795
@Test
795796
public void test_setClippingIIII() {
796-
// intermittently fails on XP for reasons unknown, comment out the test case
797-
// until the problem is figured out
798-
// Canvas canvas = new Canvas(shell, SWT.BORDER);
799-
// shell.setSize(110,110);
800-
// canvas.setSize(100,100);
801-
// shell.open();
802-
// GC testGc = new GC(canvas);
803-
// testGc.setClipping(0,5,10,20);
804-
// Rectangle rect = testGc.getClipping();
805-
// assertTrue(rect.x == 0);
806-
// assertTrue(rect.y == 5);
807-
// assertTrue(rect.width == 10);
808-
// assertTrue(rect.height == 20);
809-
// testGc.dispose();
810-
// canvas.dispose();
797+
gc.setClipping(0,5,10,20);
798+
Rectangle rect = gc.getClipping();
799+
assertAll(
800+
() -> assertEquals(0,rect.x),
801+
() -> assertEquals(5, rect.y),
802+
() -> assertEquals(10,rect.width),
803+
() -> assertEquals(20,rect.height));
811804
}
812805

813806
@Test
814807
public void test_setClippingLorg_eclipse_swt_graphics_Rectangle() {
815-
// intermittently fails on XP for reasons unknown, comment out the test case
816-
// until the problem is figured out
817-
// Canvas canvas = new Canvas(shell, SWT.BORDER);
818-
// shell.setSize(110,110);
819-
// canvas.setSize(100,100);
820-
// shell.open();
821-
// GC testGc = new GC(canvas);
822-
// testGc.setClipping(new Rectangle(0,5,10,20));
823-
// Rectangle rect = testGc.getClipping();
824-
// assertTrue(rect.x == 0);
825-
// assertTrue(rect.y == 5);
826-
// assertTrue(rect.width == 10);
827-
// assertTrue(rect.height == 20);
828-
// testGc.dispose();
829-
// canvas.dispose();
808+
gc.setClipping(new Rectangle(0,5,10,20));
809+
Rectangle rect = gc.getClipping();
810+
assertAll(
811+
() -> assertEquals(0,rect.x),
812+
() -> assertEquals(5, rect.y),
813+
() -> assertEquals(10,rect.width),
814+
() -> assertEquals(20,rect.height));
830815
}
831816

832817
@Test

0 commit comments

Comments
 (0)