Skip to content

Commit 4936418

Browse files
yusufozgullukepistrol
authored andcommitted
Add editor over scroll unit tests
1 parent 95878e9 commit 4936418

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Tests/CodeEditTextViewTests/STTextViewControllerTests.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ final class STTextViewControllerTests: XCTestCase {
3232
language: .default,
3333
font: .monospacedSystemFont(ofSize: 11, weight: .medium),
3434
theme: theme,
35-
tabWidth: 4
35+
tabWidth: 4,
36+
overScrollLineCount: 5
3637
)
3738
}
3839

@@ -60,4 +61,25 @@ final class STTextViewControllerTests: XCTestCase {
6061
XCTAssertEqual(color4, NSColor.textColor)
6162
}
6263

64+
func test_editorOverScroll() throws {
65+
let scrollView = try XCTUnwrap(controller.view as? NSScrollView)
66+
67+
// overScrollLineCount: 5, lineHeight: 13
68+
XCTAssertEqual(scrollView.contentInsets.bottom, 65)
69+
}
70+
71+
72+
func test_editorOverScroll_AfterUpdate() throws {
73+
let scrollView = try XCTUnwrap(controller.view as? NSScrollView)
74+
75+
// overScrollLineCount: 5, lineHeight: 13
76+
XCTAssertEqual(scrollView.contentInsets.bottom, 65)
77+
78+
controller.overScrollLineCount = 10
79+
controller.reloadUI()
80+
81+
// overScrollLineCount: 10, lineHeight: 13
82+
XCTAssertEqual(scrollView.contentInsets.bottom, 130)
83+
}
84+
6385
}

0 commit comments

Comments
 (0)