public void testUpdateInvalid() throws Exception { RangeMarker marker = createMarker("01[]23456789"); marker.getDocument().deleteString(1, 3); assertFalse(marker.isValid()); marker.getDocument().insertString(2, "xxx"); assertEquals(2, marker.getStartOffset()); assertEquals(2, marker.getEndOffset()); assertFalse(marker.isValid()); }
public void testDeleteRightPart2() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().deleteString(4, 5); assertValidMarker(marker, 2, 4); }
public void testInsertIntoStart() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().insertString(2, "xxx"); assertValidMarker(marker, 5, 8); }
public void testDeleteFirstChar() throws Exception { RangeMarker marker = createMarker("0123456789", 0, 5); marker.getDocument().deleteString(0, 1); assertValidMarker(marker, 0, 4); }
public void testReplaceRightPartInvalid() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().replaceString(4, 6, "xxx"); assertValidMarker(marker, 2, 4); }
public void testReplaceRangeToSingleChar() throws Exception { RangeMarker marker = createMarker("0123456789", 1, 7); marker.getDocument().replaceString(2, 5, " "); assertTrue(marker.isValid()); }
public void testDeleteRangeInside() throws Exception { RangeMarker marker = createMarker("0123456789", 1, 7); marker.getDocument().deleteString(2, 5); assertTrue(marker.isValid()); }
public void testDeletePoint() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 2); marker.getDocument().deleteString(1, 3); assertFalse(marker.isValid()); }
public void testReplaceRightIncludingFirstChar() throws Exception { String s = "12345\n \n12345"; RangeMarker marker = createMarker(s, 6, 8); marker.getDocument().replaceString(0, s.length(), s.replaceAll(" ", "")); assertValidMarker(marker, 6, 7); }
public void testInsertIntoEnd() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().insertString(5, "xxx"); assertEquals(2, marker.getStartOffset()); assertEquals(5, marker.getEndOffset()); assertTrue(marker.isValid()); }
public void testDeleteBeforeStart() throws Exception { RangeMarker marker = createMarker("01[234]56789"); marker.getDocument().deleteString(0, 1); assertEquals(1, marker.getStartOffset()); assertEquals(4, marker.getEndOffset()); assertTrue(marker.isValid()); }
public void testNested3() { RangeMarker marker1 = createMarker("01[23]4567890123"); DocumentEx document = (DocumentEx) marker1.getDocument(); RangeMarker marker2 = document.createRangeMarker(9, 11); RangeMarker marker3 = document.createRangeMarker(1, 12); marker3.dispose(); document.deleteString(marker1.getEndOffset(), marker2.getStartOffset()); }
public void testLL() { RangeMarker marker1 = createMarker("012345678901234567", 5, 6); DocumentEx document = (DocumentEx) marker1.getDocument(); document.createRangeMarker(4, 5); document.createRangeMarker(6, 7); document.createRangeMarker(0, 4); document.deleteString(1, 2); document.createRangeMarker(0, 7); document.createRangeMarker(0, 7); }
public void testInsertIntoStartExpandToLeft() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.setGreedyToLeft(true); marker.getDocument().insertString(2, "xxx"); assertEquals(2, marker.getStartOffset()); assertEquals(8, marker.getEndOffset()); assertTrue(marker.isValid()); }
public void testNestedAfter() { RangeMarker marker1 = createMarker("0[12345678]90123"); Document document = marker1.getDocument(); RangeMarker marker2 = document.createRangeMarker(2, 5); RangeMarker marker3 = document.createRangeMarker(3, 4); document.insertString(10, "x"); assertEquals(1, marker1.getStartOffset()); assertEquals(2, marker2.getStartOffset()); assertEquals(3, marker3.getStartOffset()); }
public void testBranched() { RangeMarker marker1 = createMarker("01234567890123456", 0, 1); DocumentEx document = (DocumentEx) marker1.getDocument(); RangeMarker marker2 = document.createRangeMarker(2, 3); RangeMarker marker3 = document.createRangeMarker(4, 5); RangeMarker marker4 = document.createRangeMarker(6, 7); RangeMarker marker5 = document.createRangeMarker(8, 9); RangeMarker marker6 = document.createRangeMarker(10, 11); RangeMarker marker7 = document.createRangeMarker(12, 13); RangeMarker marker8 = document.createRangeMarker(14, 15); document.deleteString(1, 2); }
public void testNoNegative() throws Exception { RangeMarker marker = createMarker( "package safd;\n\n[import javax.swing.JPanel;]\nimport java.util.ArrayList;\n\nclass T{}"); marker .getDocument() .replaceString( 15, 15 + "import javax.swing.JPanel;\nimport java.util.ArrayList;".length(), "import java.util.ArrayList;"); assertEquals(15, marker.getStartOffset()); }
public void testDevourMarkerWithDeletion() { RangeMarker marker1 = createMarker("012345[67890123456]7"); DocumentEx document = (DocumentEx) marker1.getDocument(); document.deleteString(1, document.getTextLength()); }
public void testReplacementWithOldTextOverlap() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().replaceString(0, 10, "0123456789"); assertValidMarker(marker, 2, 5); }
public void testDeleteJustBeforeStart() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().deleteString(0, 2); assertValidMarker(marker, 0, 3); }
public void testDeleteExactRange() throws Exception { RangeMarker marker = createMarker("0123456789", 2, 5); marker.getDocument().deleteString(2, 5); assertValidMarker(marker, 2, 2); }
public void testReplaceWholeRange() throws Exception { RangeMarker marker = createMarker("0123456789", 1, 7); marker.getDocument().replaceString(1, 7, "abc"); assertValidMarker(marker, 1, 4); }