Skip to content

Commit 77880e8

Browse files
committed
Fix Tests
1 parent 113be11 commit 77880e8

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Tests/CodeEditSourceEditorTests/TextViewControllerTests.swift

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ final class TextViewControllerTests: XCTestCase {
6363
XCTAssertEqual(color4, NSColor.textColor)
6464
}
6565

66+
// MARK: Overscroll
67+
68+
func test_editorOverScroll() throws {
69+
controller.editorOverscroll = 0
70+
71+
// editorOverscroll: 0
72+
XCTAssertEqual(controller.textView.overscrollAmount, 0)
73+
74+
controller.editorOverscroll = 0.5
75+
76+
// editorOverscroll: 0.5
77+
XCTAssertEqual(controller.textView.overscrollAmount, 0.5)
78+
79+
controller.editorOverscroll = 1.0
80+
81+
XCTAssertEqual(controller.textView.overscrollAmount, 1.0)
82+
}
83+
6684
// MARK: Insets
6785

6886
func test_editorInsets() throws {
@@ -106,10 +124,10 @@ final class TextViewControllerTests: XCTestCase {
106124
// contentInsets: 16
107125
// editorOverscroll: 0.5
108126
controller.contentInsets = NSEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
109-
controller.editorOverscroll = 0.5
127+
controller.editorOverscroll = 0.5 // Should be ignored
110128
controller.reloadUI()
111129

112-
try assertInsetsEqual(scrollView.contentInsets, NSEdgeInsets(top: 16, left: 16, bottom: 16 + 50, right: 16))
130+
try assertInsetsEqual(scrollView.contentInsets, NSEdgeInsets(top: 16, left: 16, bottom: 16, right: 16))
113131
XCTAssertEqual(controller.gutterView.frame.origin.y, -16)
114132
}
115133

0 commit comments

Comments
 (0)