Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java2
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java16
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java14
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java7
4 files changed, 17 insertions, 22 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
index ac8cbf7169..a413e1ed61 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
@@ -118,7 +118,7 @@ public void test_getChildren() {
@Test
@Override
-public void test_isFocusControl() {
+public void test_isFocusControl() throws InterruptedException {
if (SwtTestUtil.isGTK) {
// TODO forceFocus returns false, while isFocusControl returns true
assertFalse(control.isFocusControl());
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
index 96846558dc..cea5a95627 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
@@ -85,7 +85,7 @@ public void test_getChildren() {
@Test
@Override
-public void test_isFocusControl() {
+public void test_isFocusControl() throws InterruptedException {
if (SwtTestUtil.isCocoa) {
// TODO forceFocus returns true, while isFocusControl returns false
assertFalse(control.isFocusControl());
@@ -122,11 +122,10 @@ public void test_selectAll() {
@Override
@Test
-public void test_setFocus_toChild_afterOpen() {
+public void test_setFocus_toChild_afterOpen() throws InterruptedException {
shell.open();
- if (SwtTestUtil.isGTK) {
- shell.forceActive();
- }
+ // Wait for the shell to become active
+ processEvents(500, () -> shell.getDisplay().getActiveShell() == shell);
assertEquals(shell, shell.getDisplay().getActiveShell());
composite.setFocus();
assertTrue("First child widget should have focus", tableTree.getTable().isFocusControl());
@@ -134,12 +133,11 @@ public void test_setFocus_toChild_afterOpen() {
@Override
@Test
-public void test_setFocus_toChild_beforeOpen() {
+public void test_setFocus_toChild_beforeOpen() throws InterruptedException {
composite.setFocus();
shell.open();
- if (SwtTestUtil.isGTK) {
- shell.forceActive();
- }
+ // Wait for the shell to become active
+ processEvents(500, () -> shell.getDisplay().getActiveShell() == shell);
assertEquals(shell, shell.getDisplay().getActiveShell());
assertTrue("First child widget should have focus", tableTree.getTable().isFocusControl());
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
index 80ff839746..1d1d32efb4 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
@@ -118,25 +118,23 @@ public void test_setVisibility_and_sizing() {
}
@Test
-public void test_setFocus_toChild_afterOpen() {
+public void test_setFocus_toChild_afterOpen() throws InterruptedException {
Text focusChild = new Text(composite, SWT.NONE);
shell.open();
- if (SwtTestUtil.isGTK) {
- shell.forceActive();
- }
+ // Wait for the shell to become active
+ processEvents(500, () -> shell.getDisplay().getActiveShell() == shell);
assertEquals(shell, shell.getDisplay().getActiveShell());
composite.setFocus();
assertTrue("First child widget should have focus", focusChild.isFocusControl());
}
@Test
-public void test_setFocus_toChild_beforeOpen() {
+public void test_setFocus_toChild_beforeOpen() throws InterruptedException {
Text focusChild = new Text(composite, SWT.NONE);
composite.setFocus();
shell.open();
- if (SwtTestUtil.isGTK) {
- shell.forceActive();
- }
+ // Wait for the shell to become active
+ processEvents(500, () -> shell.getDisplay().getActiveShell() == shell);
assertEquals(shell, shell.getDisplay().getActiveShell());
assertTrue("First child widget should have focus", focusChild.isFocusControl());
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
index c45b1f4a17..63f9ceb81c 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
@@ -520,12 +520,11 @@ public void test_isEnabled() {
assertFalse(control.isEnabled());
}
@Test
-public void test_isFocusControl() {
+public void test_isFocusControl() throws InterruptedException {
assertFalse(control.isFocusControl());
shell.open();
- if (SwtTestUtil.isGTK) {
- shell.forceActive();
- }
+ // Wait for the shell to become active
+ processEvents(500, () -> shell.getDisplay().getActiveShell() == shell);
assertEquals(shell, shell.getDisplay().getActiveShell());
assertEquals("Unexpected focus", control.forceFocus(), control.isFocusControl());
}

Back to the top