Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-02-12 10:17:43 +0000
committerAndrey Loskutov2019-02-13 05:38:28 +0000
commitebdf1f3b99f9e767055d19045bf397ba42a03af7 (patch)
tree0d278440cf009db7d5162a1abc8487af319ac5aa
parent3e28656e7147b4ae8579e15d906f6d797edaeb9c (diff)
downloadeclipse.platform.text-ebdf1f3b99f9e767055d19045bf397ba42a03af7.tar.gz
eclipse.platform.text-ebdf1f3b99f9e767055d19045bf397ba42a03af7.tar.xz
eclipse.platform.text-ebdf1f3b99f9e767055d19045bf397ba42a03af7.zip
Bug 538439 - org.eclipse.ui.genericeditor.tests 4 tests fail on MacY20190213-0305
Change-Id: I68e642651a1627e3544c54cc0b5825d781eb58fc Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java16
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ReconcilerTest.java18
3 files changed, 20 insertions, 17 deletions
diff --git a/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF b/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF
index 6fc9d3932..49a6416be 100644
--- a/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
org.eclipse.text.tests;bundle-version="3.11.0",
org.eclipse.ui.workbench.texteditor.tests;bundle-version="3.11.100",
org.eclipse.ui.editors;bundle-version="3.11.0",
- org.eclipse.core.expressions
+ org.eclipse.core.expressions,
+ org.eclipse.ui.tests.harness;bundle-version="1.4.500"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-BundleShape: dir
Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java
index 6cd63024c..888192355 100644
--- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java
@@ -19,8 +19,6 @@ import java.nio.charset.StandardCharsets;
import org.junit.After;
import org.junit.Before;
-import org.eclipse.swt.widgets.Display;
-
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.resources.IFile;
@@ -31,10 +29,12 @@ import org.eclipse.text.tests.Accessor;
import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor;
import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.tests.harness.util.UITestCase;
import org.eclipse.ui.texteditor.AbstractTextEditor;
@@ -48,7 +48,8 @@ public class AbstratGenericEditorTest {
protected IProject project;
protected IFile file;
protected ExtensionBasedTextEditor editor;
-
+ protected IWorkbenchWindow window;
+
/**
* Closes intro, create {@link #project}, create {@link #file} and open {@link #editor}
* @throws Exception ex
@@ -60,6 +61,9 @@ public class AbstratGenericEditorTest {
project.create(null);
project.open(null);
project.setDefaultCharset(StandardCharsets.UTF_8.name(), null);
+ UITestCase.waitForJobs(100, 5000);
+ window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ UITestCase.forceActive(window.getShell());
createAndOpenFile();
}
@@ -80,6 +84,7 @@ public class AbstratGenericEditorTest {
this.file.setCharset(StandardCharsets.UTF_8.name(), null);
this.editor = (ExtensionBasedTextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().openEditor(new FileEditorInput(this.file), "org.eclipse.ui.genericeditor.GenericEditor");
+ UITestCase.processEvents();
}
/**
@@ -92,7 +97,7 @@ public class AbstratGenericEditorTest {
editor.close(false);
editor = null;
}
- while(Display.getDefault().readAndDispatch()) {}
+ UITestCase.processEvents();
if (file != null) {
file.delete(true, new NullProgressMonitor());
file = null;
@@ -116,6 +121,7 @@ public class AbstratGenericEditorTest {
IIntroPart intro = PlatformUI.getWorkbench().getIntroManager().getIntro();
if (intro != null) {
PlatformUI.getWorkbench().getIntroManager().closeIntro(intro);
+ UITestCase.processEvents();
}
}
@@ -123,7 +129,7 @@ public class AbstratGenericEditorTest {
long timeout = milliseconds; //ms
long start = System.currentTimeMillis();
while (start + timeout > System.currentTimeMillis()) {
- Display.getDefault().readAndDispatch();
+ UITestCase.processEvents();
}
}
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ReconcilerTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ReconcilerTest.java
index 89fbb3c83..9b3320879 100644
--- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ReconcilerTest.java
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ReconcilerTest.java
@@ -18,8 +18,6 @@ import java.io.ByteArrayInputStream;
import org.junit.Assert;
import org.junit.Test;
-import org.eclipse.swt.widgets.Display;
-
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.resources.IFile;
@@ -36,6 +34,7 @@ import org.eclipse.ui.genericeditor.tests.contributions.ReconcilerStrategyFirst;
import org.eclipse.ui.genericeditor.tests.contributions.ReconcilerStrategySecond;
import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.tests.harness.util.UITestCase;
import org.eclipse.ui.texteditor.IDocumentProvider;
@@ -98,27 +97,24 @@ public class ReconcilerTest extends AbstratGenericEditorTest {
return false;
}
}
- }.waitForCondition(Display.getDefault().getActiveShell().getDisplay(), 2000);
+ }.waitForCondition(window.getShell().getDisplay(), 2000);
Assert.assertTrue("file was not affected by reconciler", doc.get().contains(expectedText));
}
@Override
public void tearDown() throws Exception {
- if (secondEditor != null)
- {
+ if (secondEditor != null) {
secondEditor.close(false);
secondEditor = null;
- while(Display.getDefault().readAndDispatch()) {}
+ UITestCase.processEvents();
}
- if (secondFile != null)
- {
+ if (secondFile != null) {
secondFile.delete(true, new NullProgressMonitor());
secondFile = null;
}
- super.tearDown();
- if (secondProject != null)
- {
+ if (secondProject != null) {
secondProject.delete(true, new NullProgressMonitor());
}
+ super.tearDown();
}
}

Back to the top