Skip to content

Commit

Permalink
fix for flaky editor sync test #2385
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-karaman authored and LorenzoBettini committed Oct 16, 2024
1 parent b77779f commit 4ef4bd1
Showing 1 changed file with 3 additions and 6 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,16 +145,12 @@ 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 4ef4bd1

Please sign in to comment.