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