test case for a fix in commit 0cd3b58 (fix AIOOBE during editor painting)

This commit is contained in:
Dmitry Batrak
2015-06-16 10:22:24 +03:00
parent 445036099c
commit 98e2386ec3
@@ -19,6 +19,8 @@ import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.VisualPosition;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.impl.view.IterationState;
import com.intellij.openapi.util.registry.Registry;
import java.awt.*;
@@ -426,6 +428,19 @@ public class EditorRtlTest extends AbstractEditorTest {
checkSelection(1, 2);
}
public void testIterationStateAfterLineEnd() throws Exception {
init("rl");
myEditor.getCaretModel().moveToVisualPosition(new VisualPosition(0, 1, true));
IterationState it = new IterationState((EditorEx)myEditor, 1, 2, true, false, false, false);
assertFalse(it.atEnd());
assertEquals(1, it.getStartOffset());
assertEquals(2, it.getEndOffset());
it.advance();
assertTrue(it.atEnd());
assertFalse(it.hasPastLineEndBackgroundSegment());
}
private void init(String text) throws IOException {
initText(text.replace(RTL_CHAR_REPRESENTATION, RTL_CHAR));
}