mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 18:25:40 +02:00
Fix unwanted help provider issues and add help provider test to automated suite
This commit is contained in:
parent
0a0ac2396e
commit
026c8371f8
3 changed files with 43 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -17,6 +17,7 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests;
|
||||
import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite;
|
||||
import org.eclipse.cdt.ui.tests.chelp.CHelpTest;
|
||||
import org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite;
|
||||
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite;
|
||||
import org.eclipse.cdt.ui.tests.search.SearchTestSuite;
|
||||
|
@ -77,6 +78,9 @@ public class AutomatedSuite extends TestSuite {
|
|||
|
||||
// tests from package org.eclipse.cdt.ui.tests.refactoring
|
||||
addTest(RefactoringTestSuite.suite());
|
||||
|
||||
// tests from package org.eclipse.cdt.ui.tests.chelp
|
||||
addTest(CHelpTest.suite());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 Intel Corporation and others.
|
||||
* Copyright (c) 2004, 2008 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -94,6 +94,18 @@ public class CHelpTest extends TestCase {
|
|||
return new TestSuite(CHelpTest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
CHelpTestInfoProvider.fgEnabled= true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
CHelpTestInfoProvider.fgEnabled= false;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testCHelpProviderManagerGeneral(){
|
||||
CHelpProviderManager mngr = CHelpProviderManager.getDefault();
|
||||
if(mngr == null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004, 2005 Intel Corporation and others.
|
||||
* Copyright (c) 2004, 2008 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -31,6 +31,12 @@ public class CHelpTestInfoProvider implements ICHelpProvider {
|
|||
|
||||
private ICHelpBook fCHelpBooks[];
|
||||
|
||||
/**
|
||||
* Flag indicating whether this help provider should provide help info.
|
||||
* Should be set to <code>true</code> during tests only.
|
||||
*/
|
||||
static boolean fgEnabled= false;
|
||||
|
||||
public CHelpTestInfoProvider(){
|
||||
fProviderID = PROVIDER_ID_PREFIX + fNumProviders++;
|
||||
fCHelpBooks = CHelpProviderTester.getDefault().generateCHelpBooks(fProviderID);
|
||||
|
@ -52,6 +58,9 @@ public class CHelpTestInfoProvider implements ICHelpProvider {
|
|||
* @see org.eclipse.cdt.ui.ICHelpProvider#getCHelpBooks()
|
||||
*/
|
||||
public ICHelpBook[] getCHelpBooks() {
|
||||
if (!fgEnabled) {
|
||||
return new ICHelpBook[0];
|
||||
}
|
||||
Assert.assertTrue("getCHelpBooks is called before completion contributor gets initialized",fIsInitialized);
|
||||
return fCHelpBooks;
|
||||
}
|
||||
|
@ -61,6 +70,9 @@ public class CHelpTestInfoProvider implements ICHelpProvider {
|
|||
*/
|
||||
public IFunctionSummary getFunctionInfo(ICHelpInvocationContext context,
|
||||
ICHelpBook[] helpBooks, String name) {
|
||||
if (!fgEnabled) {
|
||||
return null;
|
||||
}
|
||||
Assert.assertTrue("getFunctionInfo is called before completion contributor gets initialized",fIsInitialized);
|
||||
return CHelpProviderTester.getDefault().generateFunctionInfo(helpBooks,name,fProviderID);
|
||||
}
|
||||
|
@ -71,6 +83,9 @@ public class CHelpTestInfoProvider implements ICHelpProvider {
|
|||
public IFunctionSummary[] getMatchingFunctions(
|
||||
ICHelpInvocationContext context, ICHelpBook[] helpBooks,
|
||||
String prefix) {
|
||||
if (!fgEnabled) {
|
||||
return new IFunctionSummary[0];
|
||||
}
|
||||
Assert.assertTrue("getMatchingFunctions is called before completion contributor gets initialized",fIsInitialized);
|
||||
return null; // TODO returning null until someone puts in a preference to control it.
|
||||
//return CHelpProviderTester.getDefault().generateMatchingFunctions(helpBooks,prefix,fProviderID);
|
||||
|
@ -81,6 +96,9 @@ public class CHelpTestInfoProvider implements ICHelpProvider {
|
|||
*/
|
||||
public ICHelpResourceDescriptor[] getHelpResources(
|
||||
ICHelpInvocationContext context, ICHelpBook[] helpBooks, String name) {
|
||||
if (!fgEnabled) {
|
||||
return new ICHelpResourceDescriptor[0];
|
||||
}
|
||||
Assert.assertTrue("getHelpResources is called before completion contributor gets initialized",fIsInitialized);
|
||||
return CHelpProviderTester.getDefault().generateHelpResources(helpBooks,name,fProviderID);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue