Search in sources :

Example 46 with DiffFragment

use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.

the class UtilTest method testCutFirst2.

public void testCutFirst2() {
    prepareForFragments();
    CHECK.compareAll(new DiffFragment[] { new DiffFragment(null, ")"), new DiffFragment(" {", " {") }, Util.cutFirst(new DiffFragment[] { new DiffFragment(null, ")"), new DiffFragment(") {", ") {") }));
}
Also used : DiffFragment(com.intellij.openapi.diff.ex.DiffFragment)

Example 47 with DiffFragment

use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.

the class UtilTest method testConcatenateWithOneSide.

public void testConcatenateWithOneSide() {
    DiffFragment fragment = Util.concatenate(new DiffFragment[] { new DiffFragment("1", "1"), new DiffFragment("a", null) });
    assertTrue(fragment.isModified());
    assertFalse(fragment.isOneSide());
}
Also used : DiffFragment(com.intellij.openapi.diff.ex.DiffFragment)

Example 48 with DiffFragment

use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.

the class UtilTest method testConcatenateModified.

public void testConcatenateModified() {
    DiffFragment fragment = Util.concatenate(new DiffFragment[] { new DiffFragment("a", "b"), DiffFragment.unchanged("1", "1") });
    assertTrue(fragment.isModified());
}
Also used : DiffFragment(com.intellij.openapi.diff.ex.DiffFragment)

Example 49 with DiffFragment

use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.

the class CorrectionTest method testTrueLineBlock.

public void testTrueLineBlock() throws FilesTooBigForDiffException {
    DiffCorrection.TrueLineBlocks correction = new DiffCorrection.TrueLineBlocks(ComparisonPolicy.DEFAULT);
    DiffFragment[] fragments = correction.correctAndNormalize(new DiffFragment[] { DiffFragment.unchanged(" 1\n  ab\n x\n", "  2\n ab\n x\n"), new DiffFragment("XXX\n111\n", "YYY\n222\n"), DiffFragment.unchanged(" a\n", "  a\n") });
    CHECK.compareAll(new DiffFragment[] { new DiffFragment(" 1\n", "  2\n"), new DiffFragment("  ab\n", " ab\n"), new DiffFragment(" x\n", " x\n"), new DiffFragment("XXX\n111\n", "YYY\n222\n"), new DiffFragment(" a\n", "  a\n") }, fragments);
}
Also used : DiffFragment(com.intellij.openapi.diff.ex.DiffFragment)

Example 50 with DiffFragment

use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.

the class NormalizationTest method testSingleSide.

public void testSingleSide() throws FilesTooBigForDiffException {
    DiffCorrection correction = DiffCorrection.Normalize.INSTANCE;
    DiffFragment[] corrected = correction.correct(new DiffFragment[] { new DiffFragment(null, "a"), new DiffFragment("b", null), new DiffFragment("c", "d"), new DiffFragment(null, "a"), new DiffFragment("b", null), new DiffFragment("1", null), new DiffFragment("x", "x"), new DiffFragment(null, "a") });
    CHECK.compareAll(new DiffFragment[] { new DiffFragment("b", "a"), new DiffFragment("c", "d"), new DiffFragment("b1", "a"), new DiffFragment("x", "x"), new DiffFragment(null, "a") }, corrected);
}
Also used : DiffFragment(com.intellij.openapi.diff.ex.DiffFragment)

Aggregations

DiffFragment (com.intellij.openapi.diff.ex.DiffFragment)55 DiffString (com.intellij.openapi.diff.impl.string.DiffString)15 NotNull (org.jetbrains.annotations.NotNull)13 FragmentSide (com.intellij.openapi.diff.impl.highlighting.FragmentSide)3 LineFragment (com.intellij.openapi.diff.impl.fragments.LineFragment)2 TextRange (com.intellij.openapi.util.TextRange)2 FilesTooBigForDiffException (com.intellij.util.diff.FilesTooBigForDiffException)2 Fragment (com.intellij.openapi.diff.impl.fragments.Fragment)1 DiffCorrection (com.intellij.openapi.diff.impl.processing.DiffCorrection)1 DiffFragmentsProcessor (com.intellij.openapi.diff.impl.processing.DiffFragmentsProcessor)1 Document (com.intellij.openapi.editor.Document)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Diff (com.intellij.util.diff.Diff)1 ArrayList (java.util.ArrayList)1