use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-eclipse by eclipse.
the class DefaultFoldingRegionProviderTest method testSignificantPartOfMlComment_02.
@Test
public void testSignificantPartOfMlComment_02() throws Exception {
IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/** foo\n *\n */\n element foo end");
IXtextDocument document = openFileAndReturnDocument(iFile);
DefaultFoldingRegionProvider reg = createFoldingRegionProvider();
Collection<FoldedPosition> regions = reg.getFoldingRegions(document);
assertEquals(1, regions.size());
FoldedPosition position = Iterables.getOnlyElement(regions);
assertEquals(1, position.getOffset());
assertEquals("/** foo\n *\n */\n".length(), position.getLength());
assertEquals("/** ".length(), position.computeCaptionOffset(document));
IRegion[] projectionRegions = position.computeProjectionRegions(document);
assertEquals(1, projectionRegions.length);
assertEquals("\n/** foo\n".length(), projectionRegions[0].getOffset());
assertEquals(" *\n */\n".length(), projectionRegions[0].getLength());
}
use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-eclipse by eclipse.
the class DefaultFoldingRegionProviderTest method testSignificantPartOfMlComment_04.
@Test
public void testSignificantPartOfMlComment_04() throws Exception {
IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/**\n *\n * foo */\n element foo end");
IXtextDocument document = openFileAndReturnDocument(iFile);
DefaultFoldingRegionProvider reg = createFoldingRegionProvider();
Collection<FoldedPosition> regions = reg.getFoldingRegions(document);
assertEquals(1, regions.size());
FoldedPosition position = Iterables.getOnlyElement(regions);
assertEquals(1, position.getOffset());
assertEquals("/**\n *\n * foo */\n".length(), position.getLength());
assertEquals("/**\n *\n * ".length(), position.computeCaptionOffset(document));
IRegion[] projectionRegions = position.computeProjectionRegions(document);
assertEquals(1, projectionRegions.length);
assertEquals("\n".length(), projectionRegions[0].getOffset());
assertEquals("/**\n *\n".length(), projectionRegions[0].getLength());
}
Aggregations