1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

JUnit tests for F3 on includes.

This commit is contained in:
Markus Schorn 2007-11-13 09:55:04 +00:00
parent 22a3a7bba8
commit d065bc268e
2 changed files with 47 additions and 0 deletions

View file

@ -14,6 +14,10 @@ import java.io.IOException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
@ -940,4 +944,24 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
decl = testF3(file, offset1);
assertNode("MY_MACRO", offset0, decl);
}
// int wurscht;
// #include "aheader.h"
public void testIncludeNavigation() throws Exception {
StringBuffer[] buffers= getContents(2);
String hcode= buffers[0].toString();
String scode= buffers[1].toString();
IFile hfile = importFile("aheader.h", hcode);
IFile file = importFile("includenavi.cpp", scode);
TestSourceReader.waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
IASTNode decl;
int offset0, offset1;
offset1 = scode.indexOf("aheader.h");
testF3(file, offset1);
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IEditorInput input = part.getEditorInput();
assertEquals("aheader.h", ((FileEditorInput)input).getFile().getName());
}
}

View file

@ -15,6 +15,10 @@ import java.io.IOException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
@ -475,4 +479,23 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
assertNode("MY_MACRO", offset0, decl);
}
// int wurscht;
// #include "aheader.h"
public void testIncludeNavigation() throws Exception {
StringBuffer[] buffers= getContents(2);
String hcode= buffers[0].toString();
String scode= buffers[1].toString();
IFile hfile = importFile("aheader.h", hcode);
IFile file = importFile("includenavi.c", scode);
TestSourceReader.waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
IASTNode decl;
int offset0, offset1;
offset1 = scode.indexOf("aheader.h");
testF3(file, offset1);
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IEditorInput input = part.getEditorInput();
assertEquals("aheader.h", ((FileEditorInput)input).getFile().getName());
}
}