1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix folding test

This commit is contained in:
Anton Leherbauer 2006-09-11 12:04:07 +00:00
parent c499f967c6
commit d104bdce04

View file

@ -66,6 +66,8 @@ public class FoldingTest extends TestCase {
store.setValue(PreferenceConstants.EDITOR_FOLDING_ENABLED, true);
store.setValue(PreferenceConstants.EDITOR_FOLDING_COMMENTS_ENABLED, true);
store.setValue(PreferenceConstants.EDITOR_FOLDING_PREPROCESSOR_BRANCHES_ENABLED, true);
store.setValue(PreferenceConstants.EDITOR_FOLDING_INACTIVE_CODE, false);
store.setValue(PreferenceConstants.EDITOR_FOLDING_HEADERS, false);
fEditor= (CEditor) EditorTestHelper.openInEditor(ResourceTestHelper.findFile(fTestFilename), true);
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
@ -82,6 +84,8 @@ public class FoldingTest extends TestCase {
store.setToDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED);
store.setToDefault(PreferenceConstants.EDITOR_FOLDING_COMMENTS_ENABLED);
store.setToDefault(PreferenceConstants.EDITOR_FOLDING_PREPROCESSOR_BRANCHES_ENABLED);
store.setToDefault(PreferenceConstants.EDITOR_FOLDING_INACTIVE_CODE);
store.setToDefault(PreferenceConstants.EDITOR_FOLDING_HEADERS);
super.tearDown();
}
@ -98,7 +102,7 @@ public class FoldingTest extends TestCase {
protected Position createPosition(int startLine, int endLine) throws BadLocationException {
IDocument document= fSourceViewer.getDocument();
int startOffset= document.getLineOffset(startLine);
int endOffset= document.getLineOffset(endLine) + document.getLineLength(endLine) - document.getLineDelimiter(endLine).length();
int endOffset= document.getLineOffset(endLine) + document.getLineLength(endLine);
return new Position(startOffset, endOffset - startOffset);
}
@ -155,12 +159,11 @@ public class FoldingTest extends TestCase {
createPosition(42, 46),
createPosition(48, 55),
createPosition(51, 53),
createPosition(51, 53),
createPosition(57, 59),
createPosition(61, 63),
createPosition(65, 67),
};
if (false) System.out.println(toString(actual));
if (true) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
}