mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 08:25:25 +02:00
Cosmetics.
This commit is contained in:
parent
9fc84c15c8
commit
32b06b4c26
2 changed files with 20 additions and 33 deletions
|
@ -112,7 +112,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
ISearchResultViewPart vp= NewSearchUI.getSearchResultView();
|
||||
ISearchResultPage page= vp.getActivePage();
|
||||
assertTrue(""+page, page instanceof CSearchViewPage);
|
||||
assertTrue(String.valueOf(page), page instanceof CSearchViewPage);
|
||||
|
||||
CSearchViewPage pdomsvp= (CSearchViewPage) page;
|
||||
StructuredViewer viewer= pdomsvp.getViewer();
|
||||
|
@ -221,9 +221,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
coreTestIndexerInProgress(true);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private void coreTestIndexerInProgress(boolean expectComplete) {
|
||||
// open a query
|
||||
CSearchQuery query= makeProjectQuery("data*");
|
||||
|
@ -231,10 +229,11 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
final int maximumHits = INDEXER_IN_PROGRESS_FILE_COUNT * INDEXER_IN_PROGRESS_STRUCT_COUNT;
|
||||
Object[] elements = result.getElements();
|
||||
if (expectComplete)
|
||||
if (expectComplete) {
|
||||
assertEquals(maximumHits, elements.length);
|
||||
else
|
||||
} else {
|
||||
assertTrue(maximumHits >= elements.length); // >= because may still be done
|
||||
}
|
||||
|
||||
ISearchResultViewPart vp= NewSearchUI.getSearchResultView();
|
||||
ISearchResultPage page= vp.getActivePage();
|
||||
|
@ -269,14 +268,11 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
assertFalse(firstRootNode instanceof IStatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the specified query, and return the result. When tehis method returns the
|
||||
* search page will have been opened.
|
||||
* @param query
|
||||
* @return
|
||||
* Runs the specified query, and returns the result. When this method returns,
|
||||
* the search page will have been opened.
|
||||
*/
|
||||
protected CSearchResult runQuery(CSearchQuery query) {
|
||||
final ISearchResult result[]= new ISearchResult[1];
|
||||
|
@ -305,6 +301,17 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
runEventQueue(500);
|
||||
return (CSearchResult) result[0];
|
||||
}
|
||||
|
||||
private CSearchQuery makeProjectQuery(String pattern) {
|
||||
String scope1= "Human Readable Description";
|
||||
return new CSearchPatternQuery(new ICElement[] {fCProject}, scope1, pattern, true, CSearchQuery.FIND_ALL_OCCURRENCES | CSearchPatternQuery.FIND_ALL_TYPES);
|
||||
}
|
||||
|
||||
private void assertOccurrences(CSearchQuery query, int expected) {
|
||||
query.run(npm());
|
||||
CSearchResult result= (CSearchResult) query.getSearchResult();
|
||||
assertEquals(expected, result.getMatchCount());
|
||||
}
|
||||
|
||||
// void foo() {}
|
||||
|
||||
|
@ -350,17 +357,6 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
assertOccurrences(query, 3);
|
||||
}
|
||||
|
||||
private CSearchQuery makeProjectQuery(String pattern) {
|
||||
String scope1= "Human Readable Description";
|
||||
return new CSearchPatternQuery(new ICElement[] {fCProject}, scope1, pattern, true, CSearchQuery.FIND_ALL_OCCURRENCES | CSearchPatternQuery.FIND_ALL_TYPES);
|
||||
}
|
||||
|
||||
private void assertOccurrences(CSearchQuery query, int expected) {
|
||||
query.run(npm());
|
||||
CSearchResult result= (CSearchResult) query.getSearchResult();
|
||||
assertEquals(expected, result.getMatchCount());
|
||||
}
|
||||
|
||||
// template<typename T> class CT {};
|
||||
// template<typename T> class CT<T*> {};
|
||||
// template<typename T> void f(T) {};
|
||||
|
@ -383,5 +379,4 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
query= makeProjectQuery("f");
|
||||
assertOccurrences(query, 6);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
* IBM Corporation - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
@ -58,14 +57,12 @@ import org.eclipse.cdt.internal.ui.editor.SemanticHighlightings;
|
|||
import org.eclipse.cdt.internal.ui.viewsupport.ISelectionListenerWithAST;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWithASTManager;
|
||||
|
||||
|
||||
/**
|
||||
* Tests the C/C++ Editor's occurrence marking feature.
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public class MarkOccurrenceTest extends BaseUITestCase {
|
||||
|
||||
private static final String PROJECT = "MarkOccurrenceTest";
|
||||
|
||||
private static final String OCCURRENCE_ANNOTATION= "org.eclipse.cdt.ui.occurrences";
|
||||
|
@ -92,11 +89,13 @@ public class MarkOccurrenceTest extends BaseUITestCase {
|
|||
public MarkOccurrenceTestSetup(Test test) {
|
||||
super(test);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fCProject= EditorTestHelper.createCProject(PROJECT, "resources/ceditor", false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if (fCProject != null)
|
||||
|
@ -160,9 +159,6 @@ public class MarkOccurrenceTest extends BaseUITestCase {
|
|||
SelectionListenerWithASTManager.getDefault().addListener(fEditor, fSelWASTListener);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see junit.framework.TestCase#tearDown()
|
||||
*/
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
|
||||
|
@ -585,8 +581,6 @@ public class MarkOccurrenceTest extends BaseUITestCase {
|
|||
|
||||
/**
|
||||
* Returns the occurrence annotation color.
|
||||
*
|
||||
* @return the occurrence annotation color
|
||||
*/
|
||||
private static RGB getHighlightRGB() {
|
||||
AnnotationPreference annotationPref= EditorsPlugin.getDefault().getAnnotationPreferenceLookup().getAnnotationPreference(OCCURRENCE_ANNOTATION);
|
||||
|
@ -599,8 +593,6 @@ public class MarkOccurrenceTest extends BaseUITestCase {
|
|||
|
||||
/**
|
||||
* Returns the write occurrence annotation color.
|
||||
*
|
||||
* @return the write occurrence annotation color
|
||||
*/
|
||||
private static RGB getWriteHighlightRGB() {
|
||||
AnnotationPreference annotationPref= EditorsPlugin.getDefault().getAnnotationPreferenceLookup().getAnnotationPreference(WRITE_OCCURRENCE_ANNOTATION);
|
||||
|
|
Loading…
Add table
Reference in a new issue