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 committed Oct 7, 2024
1 parent 3f13054 commit e91e2be
Showing 1 changed file with 4 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,13 @@ 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());
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
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 e91e2be

Please sign in to comment.