Search in sources :

Example 6 with LineOnOtherInfo

use of com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo in project gerrit by GerritCodeReview.

the class LineMapperTest method replaceWithInsertInB.

@Test
public void replaceWithInsertInB() {
    // 0 c c
    // 1 a b
    // 2 a b
    // 3 - b
    // 4 - b
    // 5 c c
    LineMapper mapper = new LineMapper();
    mapper.appendCommon(1);
    mapper.appendReplace(2, 4);
    mapper.appendCommon(1);
    assertEquals(4, mapper.getLineA());
    assertEquals(6, mapper.getLineB());
    assertEquals(new LineOnOtherInfo(1, true), mapper.lineOnOther(DisplaySide.B, 1));
    assertEquals(new LineOnOtherInfo(3, true), mapper.lineOnOther(DisplaySide.B, 5));
    assertEquals(new LineOnOtherInfo(2, true), mapper.lineOnOther(DisplaySide.B, 2));
    assertEquals(new LineOnOtherInfo(2, false), mapper.lineOnOther(DisplaySide.B, 3));
}
Also used : LineOnOtherInfo(com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo) Test(org.junit.Test)

Example 7 with LineOnOtherInfo

use of com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo in project gerrit by GerritCodeReview.

the class LineMapperTest method findInDeleteGap.

@Test
public void findInDeleteGap() {
    LineMapper mapper = new LineMapper();
    mapper.appendDelete(10);
    assertEquals(new LineOnOtherInfo(-1, false), mapper.lineOnOther(DisplaySide.A, 9));
}
Also used : LineOnOtherInfo(com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo) Test(org.junit.Test)

Example 8 with LineOnOtherInfo

use of com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo in project gerrit by GerritCodeReview.

the class LineMapperTest method findAfterCommon.

@Test
public void findAfterCommon() {
    LineMapper mapper = new LineMapper();
    mapper.appendCommon(10);
    assertEquals(new LineOnOtherInfo(10, true), mapper.lineOnOther(DisplaySide.A, 10));
    assertEquals(new LineOnOtherInfo(10, true), mapper.lineOnOther(DisplaySide.B, 10));
}
Also used : LineOnOtherInfo(com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo) Test(org.junit.Test)

Example 9 with LineOnOtherInfo

use of com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo in project gerrit by GerritCodeReview.

the class LineMapperTest method findAfterDeleteGap.

@Test
public void findAfterDeleteGap() {
    LineMapper mapper = new LineMapper();
    mapper.appendDelete(10);
    assertEquals(new LineOnOtherInfo(0, true), mapper.lineOnOther(DisplaySide.A, 10));
    assertEquals(new LineOnOtherInfo(10, true), mapper.lineOnOther(DisplaySide.B, 0));
}
Also used : LineOnOtherInfo(com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo) Test(org.junit.Test)

Aggregations

LineOnOtherInfo (com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo)9 Test (org.junit.Test)7 LineRegionInfo (com.google.gerrit.client.diff.UnifiedChunkManager.LineRegionInfo)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 CodeMirror (net.codemirror.lib.CodeMirror)1 LineHandle (net.codemirror.lib.CodeMirror.LineHandle)1 Pos (net.codemirror.lib.Pos)1 FromTo (net.codemirror.lib.TextMarker.FromTo)1