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

fix failing content assist tests

This commit is contained in:
Andrew Niefer 2004-11-18 21:09:43 +00:00
parent 235b6312f0
commit 7d6aa41cb5

View file

@ -53,7 +53,7 @@ public class ContentAssistTests extends TestCase {
static IWorkspace workspace; static IWorkspace workspace;
static IProject project; static IProject project;
static FileManager fileManager; static FileManager fileManager;
static boolean disabledHelpContributions = false;
{ {
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset(); (CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
@ -66,18 +66,6 @@ public class ContentAssistTests extends TestCase {
project = cPrj.getProject(); project = cPrj.getProject();
project.setSessionProperty(IndexManager.activationKey,new Boolean(false)); project.setSessionProperty(IndexManager.activationKey,new Boolean(false));
//disable the help books so we don't get proposals we weren't expecting
CHelpBookDescriptor helpBooks[];
helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
public IProject getProject(){return project;}
public ITranslationUnit getTranslationUnit(){return null;}
}
);
for( int i = 0; i < helpBooks.length; i++ ){
if( helpBooks[i] != null )
helpBooks[i].enable( false );
}
} catch ( CoreException e ) { } catch ( CoreException e ) {
/*boo*/ /*boo*/
} }
@ -99,6 +87,20 @@ public class ContentAssistTests extends TestCase {
super(name); super(name);
} }
private void disableContributions (){
//disable the help books so we don't get proposals we weren't expecting
CHelpBookDescriptor helpBooks[];
helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
public IProject getProject(){return project;}
public ITranslationUnit getTranslationUnit(){return null;}
}
);
for( int i = 0; i < helpBooks.length; i++ ){
if( helpBooks[i] != null )
helpBooks[i].enable( false );
}
}
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite( ContentAssistTests.class ); TestSuite suite = new TestSuite( ContentAssistTests.class );
suite.addTest( new ContentAssistTests("cleanupProject") ); //$NON-NLS-1$ suite.addTest( new ContentAssistTests("cleanupProject") ); //$NON-NLS-1$
@ -147,6 +149,9 @@ public class ContentAssistTests extends TestCase {
} }
protected ICompletionProposal[] getResults( IFile file, int offset ) throws Exception { protected ICompletionProposal[] getResults( IFile file, int offset ) throws Exception {
if( !disabledHelpContributions )
disableContributions();
ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create( file ); ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create( file );
String buffer = tu.getBuffer().getContents(); String buffer = tu.getBuffer().getContents();
IWorkingCopy wc = null; IWorkingCopy wc = null;