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

Fix for failing testcase.

This commit is contained in:
Markus Schorn 2006-11-22 09:01:30 +00:00
parent 6d1289a31e
commit aa1849f26b
2 changed files with 20 additions and 13 deletions

View file

@ -157,7 +157,7 @@ public class IndexBugsTests extends BaseTestCase {
String varName= "arrayDataSize";
StringBuffer content= new StringBuffer();
content.append("unsigned char arrayData[] = {\n");
for(int i=0; i<1024*500-1; i++) {
for(int i=0; i<1024*250-1; i++) {
content.append("0x00,");
}
content.append("0x00};\n");
@ -165,11 +165,9 @@ public class IndexBugsTests extends BaseTestCase {
int indexOfDecl = content.indexOf(varName);
assertTrue(CCorePlugin.getIndexManager().joinIndexer(80000, NPM));
long time= System.currentTimeMillis();
IFile file= createFile(getProject(), fileName, content.toString());
// must be done in a reasonable amount of time
waitUntilFileIsIndexed(file, 10000);
System.out.println((System.currentTimeMillis() -time));
fIndex.acquireReadLock();
try {
IIndexBinding[] bindings= fIndex.findBindings(getPattern("arrayDataSize"), true, IndexFilter.ALL, NPM);

View file

@ -192,15 +192,15 @@ public class AsyncViewerTest extends BaseUITestCase {
// + a
// + b
dlg.fViewer.setInput(root); runEventQueue(50);
assertEquals(2, countVisibleItems(dlg.fViewer));
dlg.fViewer.setInput(root);
waitForItems(dlg.fViewer, 2);
// - a
// - ...
// + b
dlg.fViewer.setExpandedState(a, true); runEventQueue(50);
dlg.fViewer.setExpandedState(a, true);
waitForItems(dlg.fViewer, 3);
assertEquals("...", dlg.fViewer.getTree().getItem(0).getItem(0).getText());
assertEquals(3, countVisibleItems(dlg.fViewer));
// - a
// + b
@ -211,14 +211,15 @@ public class AsyncViewerTest extends BaseUITestCase {
// + a
// + b
dlg.fViewer.setInput(null);
dlg.fViewer.setInput(root); runEventQueue(50);
dlg.fViewer.setInput(root);
waitForItems(dlg.fViewer, 2);
// expand async with two children
dlg.fViewer.setExpandedState(b, true); runEventQueue(50);
// + a
// - b
// - ...
assertEquals(3, countVisibleItems(dlg.fViewer));
dlg.fViewer.setExpandedState(b, true);
waitForItems(dlg.fViewer, 3);
assertEquals("...", dlg.fViewer.getTree().getItem(1).getItem(0).getText());
// - a
@ -231,17 +232,25 @@ public class AsyncViewerTest extends BaseUITestCase {
// + a
// + b
dlg.fViewer.setInput(null);
dlg.fViewer.setInput(root); runEventQueue(50);
dlg.fViewer.setInput(root);
waitForItems(dlg.fViewer, 2);
// wait until children are computed (for the sake of the +-sign)
runEventQueue(800);
assertEquals(2, countVisibleItems(dlg.fViewer));
dlg.fViewer.setExpandedState(a, true);
assertEquals(2, countVisibleItems(dlg.fViewer));
waitForItems(dlg.fViewer, 2);
dlg.fViewer.setExpandedState(b, true);
assertEquals(4, countVisibleItems(dlg.fViewer));
waitForItems(dlg.fViewer, 4);
}
private void waitForItems(TreeViewer viewer, int count) {
for (int i=0; i<100 && countVisibleItems(viewer) < count; i++) {
runEventQueue(10);
}
assertEquals(count, countVisibleItems(viewer));
}
public void testRecompute() throws InterruptedException {
TestDialog dlg = createTestDialog(true);
Node a,b,c;