Skip to content

Commit

Permalink
fix for flaky editor sync test eclipse-xtext#2385
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-karaman committed Oct 4, 2024
1 parent 76cf645 commit 34e6fac
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Objects;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
Expand Down Expand Up @@ -144,17 +145,15 @@ public void testUndoRedo() throws Exception {
try (FileWriter fw = new FileWriter(externalEditFile)) {
fw.write("");
}

assertFalse(fileDocumentProvider.isSynchronized(editor.getEditorInput()));
((IFileEditorInput)editor.getEditorInput()).getFile().refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
assertTrue(fileDocumentProvider.isSynchronized(editor.getEditorInput()));

editor.setFocus();
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
syncUtil.yieldToQueuedDisplayJobs(new NullProgressMonitor());
syncUtil.waitForReconciler(editor);
syncUtil.waitForBuild(new NullProgressMonitor());

assertTrue(fileDocumentProvider.isSynchronized(editor.getEditorInput()));

assertEquals(document.get(), "");
}

Expand Down

0 comments on commit 34e6fac

Please sign in to comment.