Search in sources :

Example 1 with Hunk

use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.

the class ChangeRegionTest method testHunkRightAfter.

@Test
public void testHunkRightAfter() throws Exception {
    ChangeRegion r = new ChangeRegion(fRevision, new LineRange(12, 3));
    List<Range> before = RangeUtil.deepClone(r.getAdjustedRanges());
    r.adjustTo(new Hunk(15, 3, 2));
    RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
    RangeUtil.assertEqualRange(before.get(0), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 3));
    before = RangeUtil.deepClone(r.getAdjustedRanges());
    r.adjustTo(new Hunk(15, -3, 2));
    RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
    RangeUtil.assertEqualRange(before.get(0), r.getAdjustedCoverage());
}
Also used : Hunk(org.eclipse.jface.internal.text.revisions.Hunk) ChangeRegion(org.eclipse.jface.internal.text.revisions.ChangeRegion) Range(org.eclipse.jface.internal.text.revisions.Range) LineRange(org.eclipse.jface.text.source.LineRange) LineRange(org.eclipse.jface.text.source.LineRange) Test(org.junit.Test)

Example 2 with Hunk

use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.

the class ChangeRegionTest method testHunkAtEnd.

@Test
public void testHunkAtEnd() throws Exception {
    ChangeRegion r;
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(17, 0, 2));
    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(17, 2, 2));
    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(15, -2, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 3), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(17, -2, 0));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
Also used : Hunk(org.eclipse.jface.internal.text.revisions.Hunk) ChangeRegion(org.eclipse.jface.internal.text.revisions.ChangeRegion) LineRange(org.eclipse.jface.text.source.LineRange) Test(org.junit.Test)

Example 3 with Hunk

use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.

the class ChangeRegionTest method testHunkOverStart.

@Test
public void testHunkOverStart() throws Exception {
    ChangeRegion r;
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(11, 0, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(13, 6), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(13, 6), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(11, 2, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(15, 6), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(15, 6), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(11, -2, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(13, 4), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(13, 4), r.getAdjustedCoverage());
}
Also used : Hunk(org.eclipse.jface.internal.text.revisions.Hunk) ChangeRegion(org.eclipse.jface.internal.text.revisions.ChangeRegion) LineRange(org.eclipse.jface.text.source.LineRange) Test(org.junit.Test)

Example 4 with Hunk

use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.

the class ChangeRegionTest method testHunkOverEnd.

@Test
public void testHunkOverEnd() throws Exception {
    ChangeRegion r;
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(18, 0, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(18, -2, 0));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(18, -2, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
    r = new ChangeRegion(fRevision, new LineRange(12, 7));
    r.adjustTo(new Hunk(17, -2, 1));
    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(17, -2, 3));
    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(17, 2, 3));
    RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
Also used : Hunk(org.eclipse.jface.internal.text.revisions.Hunk) ChangeRegion(org.eclipse.jface.internal.text.revisions.ChangeRegion) LineRange(org.eclipse.jface.text.source.LineRange) Test(org.junit.Test)

Example 5 with Hunk

use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.

the class ChangeRegionTest method testHunkBefore.

@Test
public void testHunkBefore() throws Exception {
    ChangeRegion r;
    r = new ChangeRegion(fRevision, new LineRange(12, 3));
    r.adjustTo(new Hunk(5, 3, 2));
    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(5, 3, 0));
    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(5, -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(5, 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(5, -3, 2));
    RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
    RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
}
Also used : Hunk(org.eclipse.jface.internal.text.revisions.Hunk) ChangeRegion(org.eclipse.jface.internal.text.revisions.ChangeRegion) LineRange(org.eclipse.jface.text.source.LineRange) Test(org.junit.Test)

Aggregations

Hunk (org.eclipse.jface.internal.text.revisions.Hunk)11 ChangeRegion (org.eclipse.jface.internal.text.revisions.ChangeRegion)10 LineRange (org.eclipse.jface.text.source.LineRange)10 Test (org.junit.Test)10 Range (org.eclipse.jface.internal.text.revisions.Range)2