Skip to content

Commit d262fb2

Browse files
committed
Disable Display.post tests if not running on GitHub actions
This is really just a workaround but: Fixes #2571
1 parent 9ab496e commit d262fb2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static org.junit.Assert.assertTrue;
2626
import static org.junit.Assert.fail;
2727
import static org.junit.Assume.assumeFalse;
28+
import static org.junit.Assume.assumeTrue;
2829

2930
import java.util.ArrayList;
3031
import java.util.Random;
@@ -79,6 +80,7 @@
7980
import org.junit.Assume;
8081
import org.junit.Before;
8182
import org.junit.Test;
83+
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
8284

8385
/**
8486
* Automated Test Suite for class org.eclipse.swt.custom.StyledText
@@ -5897,7 +5899,11 @@ public void test_arrowDownKeepsPositionAfterNewLine() {
58975899
* Bug 565164 - SWT.BS event no longer working
58985900
*/
58995901
@Test
5902+
@EnabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = "true", disabledReason = "Display.post tests only run successfully on GitHub actions - see https://github.com/eclipse-platform/eclipse.platform.swt/issues/2571")
59005903
public void test_backspaceAndDelete() throws InterruptedException {
5904+
assumeTrue(
5905+
"Display.post tests only run successfully on GitHub actions - see https://github.com/eclipse-platform/eclipse.platform.swt/issues/2571",
5906+
Boolean.parseBoolean(System.getenv("GITHUB_ACTIONS")));
59015907
shell.open();
59025908
text.setSize(10, 50);
59035909
// The display.post needs to successfully obtain the focused window (at least on GTK3)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.junit.jupiter.api.Test;
4949
import org.junit.jupiter.api.TestInfo;
5050
import org.junit.jupiter.api.condition.DisabledOnOs;
51+
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
5152

5253
/**
5354
* Automated Test Suite for class org.eclipse.swt.widgets.Display
@@ -1064,6 +1065,7 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
10641065
}
10651066

10661067
@Test
1068+
@EnabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = "true", disabledReason = "Display.post tests only run successfully on GitHub actions - see https://github.com/eclipse-platform/eclipse.platform.swt/issues/2571")
10671069
public void test_postLorg_eclipse_swt_widgets_Event() {
10681070
final int KEYCODE = SWT.SHIFT;
10691071

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static org.junit.Assert.assertFalse;
1818
import static org.junit.Assert.assertThrows;
1919
import static org.junit.Assert.assertTrue;
20+
import static org.junit.Assume.assumeTrue;
2021

2122
import org.eclipse.swt.SWT;
2223
import org.eclipse.swt.events.ModifyListener;
@@ -1551,6 +1552,9 @@ private void doSegmentsTest (boolean isListening) {
15511552
*/
15521553
@Test
15531554
public void test_backspaceAndDelete() throws InterruptedException {
1555+
assumeTrue(
1556+
"Display.post tests only run successfully on GitHub actions - see https://github.com/eclipse-platform/eclipse.platform.swt/issues/2571",
1557+
Boolean.parseBoolean(System.getenv("GITHUB_ACTIONS")));
15541558
shell.open();
15551559
text.setSize(10, 50);
15561560
// The display.post needs to successfully obtain the focused window (at least on GTK3)

0 commit comments

Comments
 (0)