1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

codan tests - removed sleeps and made sure it runs in non-ui thread

Change-Id: Ic684e647ea43968c7da35e0f9448e01e66c06e8f
This commit is contained in:
Alena Laskavaia 2015-02-20 21:37:47 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 2fca26b8e5
commit 32d1a28f49

View file

@ -81,11 +81,17 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
@Override @Override
public void tearDown() throws CoreException { public void tearDown() throws CoreException {
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); Display.getDefault().syncExec(new Runnable() {
for (IWorkbenchPage page : pages) { @Override
page.closeAllEditors(false); public void run() {
dispatch(200); IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
} for (IWorkbenchPage page : pages) {
page.closeAllEditors(false);
dispatch(0);
}
}
});
super.tearDown(); super.tearDown();
} }
@ -107,18 +113,23 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
// need to load before running codan because otherwise marker is lost when doing quick fix 8[] // need to load before running codan because otherwise marker is lost when doing quick fix 8[]
runCodan(); runCodan();
doRunQuickFix(); doRunQuickFix();
dispatch(500);
String result = TestUtils.loadFile(currentIFile.getContents()); String result = TestUtils.loadFile(currentIFile.getContents());
return result; return result;
} }
public void doRunQuickFix() { public void doRunQuickFix() {
for (int i = 0; i < markers.length; i++) { Display.getDefault().syncExec(new Runnable() {
IMarker marker = markers[i]; @Override
quickFix.run(marker); public void run() {
dispatch(200); for (int i = 0; i < markers.length; i++) {
} IMarker marker = markers[i];
PlatformUI.getWorkbench().saveAllEditors(false); quickFix.run(marker);
dispatch(0);
}
PlatformUI.getWorkbench().saveAllEditors(false);
}
});
} }
/** /**