public void testReplace() { final String text = "one two three"; final TextInput ti = new TextInput(text); ti.replace(4, 7, "2"); assertEquals("one 2 three", ti.asString()); ti.skipToEndOfLine(); ti.replace(0, 3, "1"); ti.setPosition(2); ti.replace(0, 2, ""); }
public void testSkipToEndOfLine() { qedeqInput.skipToEndOfLine(); assertEquals('\n', qedeqInput.readInverse()); final TextInput ti = new TextInput("\n\n\n\n"); ti.skipToEndOfLine(); assertEquals(1, ti.getPosition()); ti.skipToEndOfLine(); assertEquals(2, ti.getPosition()); ti.skipToEndOfLine(); assertEquals(3, ti.getPosition()); ti.skipToEndOfLine(); assertEquals(4, ti.getPosition()); ti.skipToEndOfLine(); assertEquals(4, ti.getPosition()); }