mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 00:45:28 +02:00
Reanabled part of the cdt-ui tests
This commit is contained in:
parent
b4c0cba081
commit
cb03e2f7d2
18 changed files with 307 additions and 190 deletions
|
@ -13,7 +13,7 @@ Export-Package: org.eclipse.cdt.ui.testplugin,
|
|||
org.eclipse.cdt.ui.tests.chelp,
|
||||
org.eclipse.cdt.ui.tests.text,
|
||||
org.eclipse.cdt.ui.tests.text.contentassist,
|
||||
org.eclipse.cdt.ui.tests.text.selectiontests
|
||||
org.eclipse.cdt.ui.tests.text.selection
|
||||
Require-Bundle: org.eclipse.jface.text,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.cdt.ui,
|
||||
|
|
|
@ -15,58 +15,8 @@ package org.eclipse.cdt.ui.tests;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.ui.tests.text.CAutoIndentTest;
|
||||
import org.eclipse.cdt.ui.tests.text.CBreakIteratorTest;
|
||||
import org.eclipse.cdt.ui.tests.text.CPartitionerTest;
|
||||
import org.eclipse.cdt.ui.tests.text.CWordIteratorTest;
|
||||
import org.eclipse.cdt.ui.tests.text.InactiveCodeHighlightingTest;
|
||||
import org.eclipse.cdt.ui.tests.text.NumberRuleTest;
|
||||
import org.eclipse.cdt.ui.tests.text.SemanticHighlightingTest;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionFailedTest_MemberReference_Arrow_Prefix2;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ArgumentType_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ArgumentType_NoPrefix2;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ArgumentType_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ClassReference_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ClassReference_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ConstructorReference;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ExceptionReference_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ExceptionReference_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_FieldType_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_FieldType_NoPrefix2;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_FieldType_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_FunctionReference_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_FunctionReference_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MacroRef_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MacroRef_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MemberReference_Arrow_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MemberReference_Arrow_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MemberReference_Dot_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_MemberReference_Dot_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_NamespaceRef_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_NamespaceRef_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_NewTypeReference_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_NewTypeReference_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ScopedReference_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ScopedReference_NonCodeScope;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_ScopedReference_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_SingleName_Method_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_SingleName_Method_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_SingleName_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_SingleName_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_SingleName_Prefix2;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_TypeDef_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_TypeRef_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_TypeRef_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_VariableType_NestedPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_VariableType_NoPrefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionTest_VariableType_Prefix;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTests;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CPPSelectionTestsCTagsIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CPPSelectionTestsDOMIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CPPSelectionTestsNoIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CSelectionTestsCTagsIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CSelectionTestsDOMIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.selectiontests.CSelectionTestsNoIndexer;
|
||||
import org.eclipse.cdt.ui.tests.text.TextTestSuite;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite;
|
||||
import org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite;
|
||||
|
||||
/**
|
||||
|
@ -87,75 +37,22 @@ public class AutomatedSuite extends TestSuite {
|
|||
*/
|
||||
public AutomatedSuite() {
|
||||
|
||||
// Success Tests
|
||||
//addTest(PartitionTokenScannerTest.suite());
|
||||
addTest(NumberRuleTest.suite());
|
||||
addTest(CAutoIndentTest.suite());
|
||||
addTest(CPartitionerTest.suite());
|
||||
|
||||
// completion tests
|
||||
addTest(CompletionTest_FieldType_Prefix.suite());
|
||||
addTest(CompletionTest_FieldType_NoPrefix.suite());
|
||||
addTest(CompletionTest_FieldType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_VariableType_Prefix.suite());
|
||||
addTest(CompletionTest_VariableType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_ArgumentType_Prefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_SingleName_Method_Prefix.suite());
|
||||
addTest(CompletionTest_SingleName_Method_NoPrefix.suite());
|
||||
addTest(CompletionTest_SingleName_Prefix.suite());
|
||||
addTest(CompletionTest_SingleName_Prefix2.suite());
|
||||
addTest(CompletionTest_SingleName_NoPrefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Dot_Prefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Dot_NoPrefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_Prefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_NoPrefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_Prefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_Prefix.suite());
|
||||
addTest(CompletionTest_ClassReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ClassReference_Prefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
||||
addTest(CompletionTest_FunctionReference_Prefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_Prefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_NonCodeScope.suite());
|
||||
addTest(CompletionTest_MacroRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_MacroRef_Prefix.suite());
|
||||
addTest(CompletionTest_FunctionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ConstructorReference.suite());
|
||||
addTest(CompletionTest_TypeDef_NoPrefix.suite());
|
||||
addTest(CompletionTest_VariableType_NestedPrefix.suite());
|
||||
|
||||
addTest( ContentAssistTests.suite() );
|
||||
|
||||
// Failed Tests
|
||||
addTest(CompletionFailedTest_MemberReference_Arrow_Prefix2.suite());
|
||||
|
||||
// selection tests
|
||||
addTest( CPPSelectionTestsNoIndexer.suite() );
|
||||
addTest( CSelectionTestsNoIndexer.suite() );
|
||||
addTest( CPPSelectionTestsDOMIndexer.suite() );
|
||||
addTest( CSelectionTestsDOMIndexer.suite() );
|
||||
addTest( CPPSelectionTestsCTagsIndexer.suite() );
|
||||
addTest( CSelectionTestsCTagsIndexer.suite() );
|
||||
// tests from package org.eclipse.cdt.ui.tests.text
|
||||
addTest(TextTestSuite.suite());
|
||||
|
||||
// Break iterator tests.
|
||||
addTest(CBreakIteratorTest.suite());
|
||||
addTest(CWordIteratorTest.suite());
|
||||
|
||||
// highlighting tests
|
||||
addTest(SemanticHighlightingTest.suite());
|
||||
addTest(InactiveCodeHighlightingTest.suite());
|
||||
|
||||
// tests for package viewsupport
|
||||
addTest(ViewSupportTestSuite.suite());
|
||||
|
||||
// tests from package org.eclipse.cdt.ui.tests.text.contentAssist
|
||||
addTest(ContentAssistTestSuite.suite());
|
||||
|
||||
// tests from package org.eclipse.cdt.ui.tests.text.contentAssist2
|
||||
// commented out because they are failing pretty badly
|
||||
// addTest(ContentAssist2TestSuite.suite());
|
||||
|
||||
// tests from package org.eclipse.cdt.ui.tests.text.selection
|
||||
// commented out because they are failing pretty badly
|
||||
// addTest(SelectionTestSuite.suite());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class TextTestSuite extends TestSuite {
|
||||
|
||||
public static TestSuite suite() {
|
||||
return new TextTestSuite();
|
||||
}
|
||||
|
||||
public TextTestSuite() {
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.text.text");
|
||||
|
||||
// Success Tests
|
||||
//addTest(PartitionTokenScannerTest.suite());
|
||||
addTest(NumberRuleTest.suite());
|
||||
addTest(CAutoIndentTest.suite());
|
||||
addTest(CPartitionerTest.suite());
|
||||
|
||||
// Break iterator tests.
|
||||
addTest(CBreakIteratorTest.suite());
|
||||
addTest(CWordIteratorTest.suite());
|
||||
|
||||
// highlighting tests
|
||||
addTest(SemanticHighlightingTest.suite());
|
||||
addTest(InactiveCodeHighlightingTest.suite());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class ContentAssistTestSuite extends TestSuite {
|
||||
|
||||
public static TestSuite suite() {
|
||||
return new ContentAssistTestSuite();
|
||||
}
|
||||
|
||||
public ContentAssistTestSuite() {
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.text.contentassist");
|
||||
|
||||
// completion tests
|
||||
addTest(CompletionTest_FieldType_Prefix.suite());
|
||||
addTest(CompletionTest_FieldType_NoPrefix.suite());
|
||||
addTest(CompletionTest_FieldType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_VariableType_Prefix.suite());
|
||||
addTest(CompletionTest_VariableType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_ArgumentType_Prefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_SingleName_Method_Prefix.suite());
|
||||
addTest(CompletionTest_SingleName_Method_NoPrefix.suite());
|
||||
addTest(CompletionTest_SingleName_Prefix.suite());
|
||||
addTest(CompletionTest_SingleName_Prefix2.suite());
|
||||
addTest(CompletionTest_SingleName_NoPrefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Dot_Prefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Dot_NoPrefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_Prefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_NoPrefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_Prefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_Prefix.suite());
|
||||
addTest(CompletionTest_ClassReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ClassReference_Prefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
||||
addTest(CompletionTest_FunctionReference_Prefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_Prefix.suite());
|
||||
addTest(CompletionTest_ScopedReference_NonCodeScope.suite());
|
||||
addTest(CompletionTest_MacroRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_MacroRef_Prefix.suite());
|
||||
addTest(CompletionTest_FunctionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ConstructorReference.suite());
|
||||
addTest(CompletionTest_TypeDef_NoPrefix.suite());
|
||||
addTest(CompletionTest_VariableType_NestedPrefix.suite());
|
||||
|
||||
addTest( ContentAssistTests.suite() );
|
||||
|
||||
// Failed Tests
|
||||
addTest(CompletionFailedTest_MemberReference_Arrow_Prefix2.suite());
|
||||
}
|
||||
}
|
|
@ -16,13 +16,15 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* This suite bundles all tests for the CContentAssistProcessor2
|
||||
*/
|
||||
public class ContentAssistProcessor2_Suite extends TestSuite {
|
||||
public class ContentAssist2TestSuite extends TestSuite {
|
||||
|
||||
public static Test suite() {
|
||||
return new ContentAssistProcessor2_Suite() ;
|
||||
return new ContentAssist2TestSuite() ;
|
||||
}
|
||||
|
||||
public ContentAssistProcessor2_Suite() {
|
||||
public ContentAssist2TestSuite() {
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.text.contentassist2");
|
||||
|
||||
addTest(CompletionFailedTest_MemberReference_Arrow_Prefix2.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2.suite());
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
|
@ -16,17 +17,6 @@ import java.io.InputStream;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -49,6 +39,22 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
|
||||
|
||||
/**
|
||||
* Base test class for testing Ctrl_F3/F3 with the indexers.
|
||||
*
|
||||
|
@ -190,8 +196,8 @@ public class BaseSelectionTestsIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDeclarationsAction action = (OpenDeclarationsAction) ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// update the file/part to point to the newly opened IFile/IEditorPart
|
||||
part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
||||
|
@ -278,8 +284,8 @@ public class BaseSelectionTestsIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDefinitionAction action = (OpenDefinitionAction) ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// update the file/part to point to the newly opened IFile/IEditorPart
|
||||
part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
||||
|
@ -328,8 +334,8 @@ public class BaseSelectionTestsIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDefinitionAction action = (OpenDefinitionAction) ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// update the file/part to point to the newly opened IFile/IEditorPart
|
||||
part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
|
@ -20,17 +21,6 @@ import junit.framework.Test;
|
|||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -41,7 +31,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.TextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
|
@ -52,6 +41,22 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
|
||||
|
||||
/**
|
||||
* It is required to test the selection performance independent of the indexer to make sure that the DOM is functioning properly.
|
||||
*
|
||||
|
@ -222,8 +227,8 @@ public class CPPSelectionTestsNoIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDeclarationsAction action = (OpenDeclarationsAction) ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// the action above should highlight the declaration, so now retrieve it and use that selection to get the IASTName selected on the TU
|
||||
ISelection sel = ((AbstractTextEditor)part).getSelectionProvider().getSelection();
|
||||
|
@ -266,8 +271,8 @@ public class CPPSelectionTestsNoIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDefinitionAction action = (OpenDefinitionAction) ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// the action above should highlight the declaration, so now retrieve it and use that selection to get the IASTName selected on the TU
|
||||
ISelection sel = ((AbstractTextEditor)part).getSelectionProvider().getSelection();
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -7,8 +7,9 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.selectiontests;
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
|
@ -18,17 +19,6 @@ import junit.framework.Test;
|
|||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -39,7 +29,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.TextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
|
@ -50,6 +39,22 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
|
||||
|
||||
/**
|
||||
* It is required to test the selection performance independent of the indexer to make sure that the DOM is functioning properly.
|
||||
*
|
||||
|
@ -274,8 +279,8 @@ public class CSelectionTestsNoIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDeclarationsAction action = (OpenDeclarationsAction) ((AbstractTextEditor)part).getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// the action above should highlight the declaration, so now retrieve it and use that selection to get the IASTName selected on the TU
|
||||
ISelection sel = ((AbstractTextEditor)part).getSelectionProvider().getSelection();
|
||||
|
@ -317,8 +322,8 @@ public class CSelectionTestsNoIndexer extends TestCase {
|
|||
if (part instanceof AbstractTextEditor) {
|
||||
((AbstractTextEditor)part).getSelectionProvider().setSelection(new TextSelection(offset,length));
|
||||
|
||||
final IAction action = ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.run();
|
||||
final OpenDefinitionAction action = (OpenDefinitionAction) ((AbstractTextEditor)part).getAction("OpenDefinition"); //$NON-NLS-1$
|
||||
action.runSync();
|
||||
|
||||
// the action above should highlight the declaration, so now retrieve it and use that selection to get the IASTName selected on the TU
|
||||
ISelection sel = ((AbstractTextEditor)part).getSelectionProvider().getSelection();
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text.selection;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class SelectionTestSuite extends TestSuite {
|
||||
|
||||
public static TestSuite suite() {
|
||||
return new SelectionTestSuite();
|
||||
}
|
||||
|
||||
public SelectionTestSuite() {
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.text.selection");
|
||||
|
||||
// selection tests
|
||||
addTest( CPPSelectionTestsNoIndexer.suite() );
|
||||
addTest( CSelectionTestsNoIndexer.suite() );
|
||||
addTest( CPPSelectionTestsDOMIndexer.suite() );
|
||||
addTest( CSelectionTestsDOMIndexer.suite() );
|
||||
addTest( CPPSelectionTestsCTagsIndexer.suite() );
|
||||
addTest( CSelectionTestsCTagsIndexer.suite() );
|
||||
}
|
||||
}
|
|
@ -109,11 +109,13 @@ public class AsyncViewerTest extends TestCase {
|
|||
public void testSyncPopulation() {
|
||||
TestDialog dlg = createTestDialog(false);
|
||||
doTestSyncPopulation(dlg);
|
||||
dlg.close();
|
||||
}
|
||||
|
||||
public void testSyncPopulationEx() {
|
||||
TestDialog dlg = createTestDialog(true);
|
||||
doTestSyncPopulation(dlg);
|
||||
dlg.close();
|
||||
}
|
||||
|
||||
private void doTestSyncPopulation(TestDialog dlg) {
|
||||
|
@ -159,11 +161,13 @@ public class AsyncViewerTest extends TestCase {
|
|||
public void testAsyncPopulation() throws InterruptedException {
|
||||
TestDialog dlg = createTestDialog(false);
|
||||
doTestAsyncPopulation(dlg);
|
||||
dlg.close();
|
||||
}
|
||||
|
||||
public void testAsyncPopulationEx() throws InterruptedException {
|
||||
TestDialog dlg = createTestDialog(true);
|
||||
doTestAsyncPopulation(dlg);
|
||||
dlg.close();
|
||||
}
|
||||
|
||||
private void doTestAsyncPopulation(TestDialog dlg) throws InterruptedException {
|
||||
|
@ -265,6 +269,7 @@ public class AsyncViewerTest extends TestCase {
|
|||
assertEquals(6, countVisibleItems(dlg.fViewer));
|
||||
assertEquals(1, dlg.fViewer.getTree().getSelectionCount());
|
||||
assertEquals("c", dlg.fViewer.getTree().getSelection()[0].getText());
|
||||
dlg.close();
|
||||
}
|
||||
|
||||
private void sleepAndDispatch(int sleep, int count) throws InterruptedException {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ViewSupportTestSuite extends TestSuite {
|
|||
}
|
||||
|
||||
public ViewSupportTestSuite() {
|
||||
super("View support tests");
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.viewsupport");
|
||||
addTestSuite(AsyncViewerTest.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.search.actions;
|
||||
|
@ -23,6 +24,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
|
@ -70,7 +72,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
if (binding != null && !(binding instanceof IProblemBinding)) {
|
||||
final IASTName[] declNames = ast.getDeclarations(binding);
|
||||
if (declNames.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
runInUIThread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
open(declNames[0]);
|
||||
|
@ -113,5 +115,25 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
new Runner().schedule();
|
||||
}
|
||||
}
|
||||
|
||||
private void runInUIThread(Runnable runnable) {
|
||||
if (Display.getCurrent() != null) {
|
||||
runnable.run();
|
||||
}
|
||||
else {
|
||||
Display.getDefault().asyncExec(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For the purpose of regression testing.
|
||||
* @since 4.0
|
||||
*/
|
||||
public void runSync() {
|
||||
selNode = getSelectedStringFromEditor();
|
||||
if (selNode != null) {
|
||||
new Runner().run(new NullProgressMonitor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,24 +7,28 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.search.actions;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
/**
|
||||
* Open Definition Action (Ctrl+F3).
|
||||
|
@ -70,7 +74,7 @@ public class OpenDefinitionAction extends SelectionParseAction {
|
|||
if (binding != null) {
|
||||
final IASTName[] declNames = ast.getDefinitions(binding);
|
||||
if (declNames.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
runInUIThread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
open(declNames[0]);
|
||||
|
@ -97,4 +101,28 @@ public class OpenDefinitionAction extends SelectionParseAction {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For the purpose of regression testing.
|
||||
* @since 4.0
|
||||
*/
|
||||
private void runInUIThread(Runnable runnable) {
|
||||
if (Display.getCurrent() != null) {
|
||||
runnable.run();
|
||||
}
|
||||
else {
|
||||
Display.getDefault().asyncExec(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For the purpose of regression testing.
|
||||
* @since 4.0
|
||||
*/
|
||||
public void runSync() {
|
||||
selNode = getSelectedStringFromEditor();
|
||||
if (selNode != null) {
|
||||
new Runner().run(new NullProgressMonitor());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
<target name="suite">
|
||||
<antcall target="cdt-core"/>
|
||||
<!--antcall target="cdt-ui"/-->
|
||||
<antcall target="cdt-ui"/>
|
||||
<antcall target="cdt-debug-ui"/>
|
||||
<antcall target="cdt-mbs-core"/>
|
||||
<!--antcall target="cdt-mbs-ui"/-->
|
||||
|
|
Loading…
Add table
Reference in a new issue