use of org.eclipse.jface.internal.text.revisions.ChangeRegion in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkAtStart.
@Test
public void testHunkAtStart() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(14, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(14, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -2, 1));
RangeUtil.assertEqualSingleRange(new LineRange(13, 4), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 4), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(15, 7), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 7), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(17, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(17, 5), r.getAdjustedCoverage());
}
use of org.eclipse.jface.internal.text.revisions.ChangeRegion in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkRightBefore.
@Test
public void testHunkRightBefore() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(10, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(10, 2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(14, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(14, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, -3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, -1, 2));
RangeUtil.assertEqualSingleRange(new LineRange(11, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(11, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, 3, 3));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(12, 3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
}
Aggregations