Skip to content

Commit 5ae97be

Browse files
committed
Cleanups in unstable tests in I-builds
Use DisplayHelper to delay checks so listener changes can propagate. Remove unused variables.
1 parent 2521210 commit 5ae97be

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
3+
<classpathentry kind="src" path="src">
4+
<attributes>
5+
<attribute name="test" value="true"/>
6+
</attributes>
7+
</classpathentry>
48
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
9+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
10+
<attributes>
11+
<attribute name="module" value="true"/>
12+
</attributes>
13+
</classpathentry>
614
<classpathentry kind="output" path="bin"/>
715
</classpath>

tests/org.eclipse.e4.ui.tests/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="2.4.0",
2929
org.eclipse.e4.ui.css.swt;bundle-version="0.11.0",
3030
org.mockito.mockito-core;bundle-version="2.13.0",
3131
org.eclipse.e4.ui.css.core;bundle-version="0.10.100",
32-
org.eclipse.test;bundle-version="3.6.200"
32+
org.eclipse.test;bundle-version="3.6.200",
33+
org.eclipse.ui.tests.harness
3334
Bundle-RequiredExecutionEnvironment: JavaSE-17
3435
Export-Package: org.eclipse.e4.ui.tests.model.test,
3536
org.eclipse.e4.ui.tests.model.test.impl,

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MWindowTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2023 IBM Corporation and others.
2+
* Copyright (c) 2009, 2024 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
@@ -50,6 +50,7 @@
5050
import org.eclipse.swt.widgets.Shell;
5151
import org.eclipse.swt.widgets.Tree;
5252
import org.eclipse.swt.widgets.Widget;
53+
import org.eclipse.ui.tests.harness.util.DisplayHelper;
5354
import org.junit.Ignore;
5455
import org.junit.Rule;
5556
import org.junit.Test;
@@ -365,12 +366,9 @@ public void testWindow_Height() {
365366
// the shell's width should have been updated
366367
window.setHeight(300);
367368

368-
while (shell.getDisplay().readAndDispatch()) {
369-
// spin the event loop
370-
}
371-
369+
// Give time for change to propagate
370+
DisplayHelper.waitForCondition(shell.getDisplay(), 10000, () -> (300 == shell.getBounds().height));
372371
assertEquals(shell.getBounds().height, window.getHeight());
373-
assertEquals(300, shell.getBounds().height);
374372
}
375373

376374
@Test

tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java

Lines changed: 1 addition & 5 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, 2024 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
@@ -159,7 +159,6 @@ public void testReplaceQuery() throws Exception {
159159
IFile file = (IFile) f;
160160
ITextEditor editor= (ITextEditor)SearchTestPlugin.openTextEditor(SearchPlugin.getActivePage(), file);
161161
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
162-
int annotationCount= 0;
163162
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
164163
for (Iterator<Annotation> annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
165164
Annotation annotation= annotations.next();
@@ -169,7 +168,6 @@ public void testReplaceQuery() throws Exception {
169168
assertTrue(text.equalsIgnoreCase(fQuery2.getSearchString()));
170169
}
171170
}
172-
assertEquals(0, annotationCount);
173171
}
174172
} finally {
175173
SearchPlugin.getActivePage().closeAllEditors(false);
@@ -188,7 +186,6 @@ public void testSwitchQuery() throws Exception {
188186
IFile file = (IFile) f;
189187
ITextEditor editor= (ITextEditor)SearchTestPlugin.openTextEditor(SearchPlugin.getActivePage(), file);
190188
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
191-
int annotationCount= 0;
192189
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
193190
for (Iterator<Annotation> annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
194191
Annotation annotation= annotations.next();
@@ -198,7 +195,6 @@ public void testSwitchQuery() throws Exception {
198195
assertTrue(text.equalsIgnoreCase(fQuery1.getSearchString()));
199196
}
200197
}
201-
assertEquals(0, annotationCount);
202198
}
203199
} finally {
204200
SearchPlugin.getActivePage().closeAllEditors(false);

0 commit comments

Comments
 (0)