Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-26 15:48:12 +0000
committerAnton Leherbauer2008-02-26 15:48:12 +0000
commit38315df8f8504e77fff1c4d8aca7a5b10482c62f (patch)
tree4efd72cd480ba6b6f67926ddcdf961dadab8585f /core/org.eclipse.cdt.ui.tests
parent69f1f5638264fe1847a129ec0ac70460cd44889f (diff)
downloadorg.eclipse.cdt-38315df8f8504e77fff1c4d8aca7a5b10482c62f.tar.gz
org.eclipse.cdt-38315df8f8504e77fff1c4d8aca7a5b10482c62f.tar.xz
org.eclipse.cdt-38315df8f8504e77fff1c4d8aca7a5b10482c62f.zip
Fix doc comment highlighting test
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/DocCommentHighlightingTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/DocCommentHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/DocCommentHighlightingTest.java
index 1397afb756a..b12a3a0ad73 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/DocCommentHighlightingTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/DocCommentHighlightingTest.java
@@ -17,7 +17,10 @@ import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -92,6 +95,9 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
AbstractTextEditor fEditor= (CEditor) EditorTestHelper.openInEditor(ResourceTestHelper.findFile(fTestFilename), true);
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
+ // source positions depend on Windows line separator
+ adjustLineSeparator(fSourceViewer.getDocument(), "\r\n");
+ fEditor.doSave(new NullProgressMonitor());
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
}
@@ -104,6 +110,22 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
super.tearDown();
}
+ /**
+ * Make the document use the given line separator.
+ *
+ * @param document
+ * @param lineSeparator
+ */
+ private void adjustLineSeparator(IDocument document, String lineSeparator) throws BadLocationException {
+ for (int i= 0; i < document.getNumberOfLines(); i++) {
+ String delimiter= document.getLineDelimiter(i);
+ if (delimiter != null && !delimiter.equals(lineSeparator)) {
+ IRegion lineRegion= document.getLineInformation(i);
+ document.replace(lineRegion.getOffset() + lineRegion.getLength(), delimiter.length(), lineSeparator);
+ }
+ }
+ }
+
protected List/*<Position>*/ findRangesColored(RGB rgb) {
List result= new ArrayList();
IEditorPart p= get();

Back to the top