void () { initText("<caret>" + StringUtil.repeat("abc", 100)); int spaceWidth = EditorUtil.getSpaceWidth(Font.PLAIN, getEditor()); EditorTestUtil.setEditorVisibleSize(getEditor(), 15, 2); // test for right scroll offset for (int i = 0; i < 49; ++i) { right(); } assertEquals(37 * spaceWidth, getEditor().getScrollingModel().getHorizontalScrollOffset()); // test for left scroll offset for (int i = 0; i < 20; ++i) { left(); } // caret offset is 30 now assertEquals(26 * spaceWidth, getEditor().getScrollingModel().getHorizontalScrollOffset()); }