From 7d6aa41cb58fb11171b59c7c413e31bdf7f70a4b Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Thu, 18 Nov 2004 21:09:43 +0000 Subject: [PATCH] fix failing content assist tests --- .../contentassist/ContentAssistTests.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java index 0af6158ede3..d6e4526a79f 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java @@ -53,7 +53,7 @@ public class ContentAssistTests extends TestCase { static IWorkspace workspace; static IProject project; static FileManager fileManager; - + static boolean disabledHelpContributions = false; { (CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset(); monitor = new NullProgressMonitor(); @@ -66,18 +66,6 @@ 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*/ } @@ -99,6 +87,20 @@ public class ContentAssistTests extends TestCase { 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() { TestSuite suite = new TestSuite( ContentAssistTests.class ); suite.addTest( new ContentAssistTests("cleanupProject") ); //$NON-NLS-1$ @@ -146,7 +148,10 @@ public class ContentAssistTests extends TestCase { return file; } - 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 ); String buffer = tu.getBuffer().getContents(); IWorkingCopy wc = null;