use of org.eclipse.jface.text.IRegion in project eclipse.platform.text by eclipse.
the class ProjectionMappingTest method test12c.
@Test
public void test12c() {
// test toExactImageRegions
// test a region completely comprised by a fragment at the beginning of a fragment
createStandardProjection();
try {
IRegion[] actual = fProjectionMapping.toExactImageRegions(new Region(20, 10));
IRegion[] expected = new IRegion[] { new Region(0, 10) };
assertRegions(expected, actual);
} catch (BadLocationException e) {
assertTrue(false);
}
}
use of org.eclipse.jface.text.IRegion in project eclipse.platform.text by eclipse.
the class ProjectionMappingTest method test12a.
@Test
public void test12a() {
// test toExactImageRegions
// test the whole master document
createStandardProjection();
try {
IRegion[] actual = fProjectionMapping.toExactImageRegions(new Region(0, fMasterDocument.getLength()));
IRegion[] expected = new IRegion[] { new Region(0, 20), new Region(20, 20) };
assertRegions(expected, actual);
} catch (BadLocationException e) {
assertTrue(false);
}
}
use of org.eclipse.jface.text.IRegion in project eclipse.platform.text by eclipse.
the class ProjectionMappingTest method test11d.
@Test
public void test11d() {
// test toExactOriginRegions
// test a region completely comprised by a segment at the end of a segment
createStandardProjection();
try {
IRegion[] actual = fProjectionMapping.toExactOriginRegions(new Region(10, 10));
IRegion[] expected = new IRegion[] { new Region(30, 10) };
assertRegions(expected, actual);
} catch (BadLocationException e) {
assertTrue(false);
}
}
use of org.eclipse.jface.text.IRegion in project eclipse.platform.text by eclipse.
the class ProjectionMappingTest method test1.
@Test
public void test1() {
// test getCoverage
createStandardProjection();
IRegion coverage = fProjectionMapping.getCoverage();
assertTrue(coverage.getOffset() == 20);
assertTrue(coverage.getLength() == 60);
}
use of org.eclipse.jface.text.IRegion in project eclipse.platform.text by eclipse.
the class ChildDocumentTest method checkLineInformationConsistency.
protected void checkLineInformationConsistency() {
DefaultLineTracker textTracker = new DefaultLineTracker();
textTracker.set(fDocument.get());
int textLines = textTracker.getNumberOfLines();
int trackerLines = fDocument.getNumberOfLines();
assertEquals("Child document store and child line tracker are inconsistent", trackerLines, textLines);
for (int i = 0; i < trackerLines; i++) {
IRegion trackerLine = null;
IRegion textLine = null;
try {
trackerLine = fDocument.getLineInformation(i);
textLine = textTracker.getLineInformation(i);
} catch (BadLocationException e) {
assertTrue("BadLocationException thrown", false);
}
assertEquals("Child document store and child line tracker are inconsistent", trackerLine.getOffset(), textLine.getOffset());
assertEquals("Child document store and child line tracker are inconsistent", trackerLine.getLength(), textLine.getLength());
}
}
Aggregations