void () { initText("<caret>" + StringUtil.repeat("abc\n", 100)); int scrollOffBefore = getEditor().getSettings().getVerticalScrollOffset(); getEditor().getSettings().setVerticalScrollOffset(3); int lineHeight = getEditor().getLineHeight(); EditorTestUtil.setEditorVisibleSize(getEditor(), 10, 10); // test for bottom scroll offset for (int i = 0; i < 49; ++i) { down(); } assertEquals(43 * lineHeight, getEditor().getScrollingModel().getVerticalScrollOffset()); // test for top scroll offset for (int i = 0; i < 20; ++i) { up(); } assertEquals(26 * lineHeight, getEditor().getScrollingModel().getVerticalScrollOffset()); getEditor().getSettings().setVerticalScrollOffset(scrollOffBefore); }