mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 23:15:24 +02:00
fix failures in content assist tests
This commit is contained in:
parent
9891f98c52
commit
bb46ce4f7f
3 changed files with 32 additions and 1 deletions
|
@ -21,9 +21,13 @@ import junit.framework.TestCase;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.text.CHelpBookDescriptor;
|
||||
import org.eclipse.cdt.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.testplugin.FileManager;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -54,6 +58,18 @@ abstract public class BaseTestFramework extends TestCase {
|
|||
|
||||
project = cproject.getProject();
|
||||
project.setSessionProperty(IndexManager.activationKey, 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 ) {
|
||||
/*boo*/
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ContentAssistRegressionTests extends BaseTestFramework {
|
|||
// call the CompletionProcessor
|
||||
CCompletionProcessor completionProcessor = new CCompletionProcessor(null);
|
||||
ICompletionProposal[] results = completionProcessor.evalProposals( new Document(buffer), offset, wc, null);
|
||||
return results;
|
||||
return ( results != null ? results : new ICompletionProposal [0] );
|
||||
}
|
||||
|
||||
public static Test suite(){
|
||||
|
|
|
@ -29,9 +29,12 @@ import org.eclipse.cdt.core.model.ICProject;
|
|||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.text.CHelpBookDescriptor;
|
||||
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor;
|
||||
import org.eclipse.cdt.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.testplugin.FileManager;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -63,6 +66,18 @@ public class ContentAssistTests extends TestCase {
|
|||
|
||||
project = cPrj.getProject();
|
||||
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 ) {
|
||||
/*boo*/
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue