void () { FontLayoutService.setInstance(new MockFontLayoutService(cp -> cp == 'Z' ? 2 * TEST_CHAR_WIDTH : TEST_CHAR_WIDTH, TEST_LINE_HEIGHT, TEST_DESCENT)); initText(StringUtil.repeatSymbol('Z', 500) + "<caret>"); setEditorVisibleSize(100, 100); type(' '); Rectangle visibleArea = getEditor().getScrollingModel().getVisibleAreaOnScrollingFinished(); Point caretPosition = getEditor().visualPositionToXY(getEditor().getCaretModel().getVisualPosition()); assertTrue(visibleArea.contains(caretPosition)); }