mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix JUnit tests
This commit is contained in:
parent
518b582cd0
commit
36b57b7212
4 changed files with 24 additions and 21 deletions
|
@ -80,10 +80,12 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
return new TestSuite(BasicCEditorTest.class);
|
return new TestSuite(BasicCEditorTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown () throws Exception {
|
protected void tearDown () throws Exception {
|
||||||
EditorTestHelper.closeEditor(fEditor);
|
EditorTestHelper.closeEditor(fEditor);
|
||||||
if (fCProject != null)
|
if (fCProject != null)
|
||||||
|
@ -185,6 +187,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
//
|
||||||
public void testEditNewTranslationUnit() throws Exception {
|
public void testEditNewTranslationUnit() throws Exception {
|
||||||
fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false);
|
fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false);
|
||||||
IFile newFile= createFile(fCProject.getProject(), "Point.cpp", "");
|
IFile newFile= createFile(fCProject.getProject(), "Point.cpp", "");
|
||||||
|
@ -222,7 +225,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
setUpEditor(newFile);
|
setUpEditor(newFile);
|
||||||
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
|
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
content= fDocument.get();
|
content= fDocument.get().trim();
|
||||||
assertEquals("Save failed", newContent, content);
|
assertEquals("Save failed", newContent, content);
|
||||||
// check reconciler
|
// check reconciler
|
||||||
ITranslationUnit tUnit= (ITranslationUnit)fEditor.getInputCElement();
|
ITranslationUnit tUnit= (ITranslationUnit)fEditor.getInputCElement();
|
||||||
|
@ -352,6 +355,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
fAccessor.invoke("handleKeyDown", new Object[] {event});
|
fAccessor.invoke("handleKeyDown", new Object[] {event});
|
||||||
|
|
||||||
new DisplayHelper() {
|
new DisplayHelper() {
|
||||||
|
@Override
|
||||||
protected boolean condition() {
|
protected boolean condition() {
|
||||||
return fDocListener.fDocChanged;
|
return fDocListener.fDocChanged;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import junit.framework.Assert;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRegion;
|
import org.eclipse.jface.text.IRegion;
|
||||||
|
@ -89,6 +88,7 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
fCProject= EditorTestHelper.createCProject(PROJECT, LINKED_FOLDER);
|
fCProject= EditorTestHelper.createCProject(PROJECT, LINKED_FOLDER);
|
||||||
|
@ -97,10 +97,10 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
|
||||||
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
|
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
|
||||||
// source positions depend on Windows line separator
|
// source positions depend on Windows line separator
|
||||||
adjustLineSeparator(fSourceViewer.getDocument(), "\r\n");
|
adjustLineSeparator(fSourceViewer.getDocument(), "\r\n");
|
||||||
fEditor.doSave(new NullProgressMonitor());
|
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown () throws Exception {
|
protected void tearDown () throws Exception {
|
||||||
EditorTestHelper.closeAllEditors();
|
EditorTestHelper.closeAllEditors();
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,8 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
|
||||||
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
|
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
|
||||||
|
|
||||||
for(String keyword : languageKeywords.getPreprocessorKeywords()) {
|
for(String keyword : languageKeywords.getPreprocessorKeywords()) {
|
||||||
keyword = keyword + ' ';
|
if (keyword.startsWith(prefix) && keyword.length() > prefixLength) {
|
||||||
String repString = keyword;
|
String repString = keyword + ' ';
|
||||||
if (repString.startsWith(prefix) && keyword.length() > prefixLength) {
|
|
||||||
int repLength = prefixLength;
|
int repLength = prefixLength;
|
||||||
int repOffset = context.getInvocationOffset() - repLength;
|
int repOffset = context.getInvocationOffset() - repLength;
|
||||||
if (prefix.charAt(0) == '#') {
|
if (prefix.charAt(0) == '#') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue