Add further scrollback option for longer terminal history

This commit is contained in:
2026-04-27 13:18:27 +10:00
parent 9f6e607e78
commit 507d77a0de
19 changed files with 349 additions and 32 deletions

View File

@@ -0,0 +1,34 @@
import XCTest
@testable import CommandNotch
final class TerminalScrollbackEstimatorTests: XCTestCase {
func testEstimateIncreasesAsScrollbackGrows() {
let small = TerminalScrollbackEstimator.estimate(
scrollbackLines: 5_000,
fontSize: 13,
openWidth: 640,
openHeight: 350
)
let large = TerminalScrollbackEstimator.estimate(
scrollbackLines: 100_000,
fontSize: 13,
openWidth: 640,
openHeight: 350
)
XCTAssertGreaterThan(large.bytes, small.bytes)
XCTAssertGreaterThan(large.columns, 0)
XCTAssertGreaterThan(large.rows, 0)
}
func testEstimateClampsNegativeScrollbackToZero() {
let estimate = TerminalScrollbackEstimator.estimate(
scrollbackLines: -1_000,
fontSize: 13,
openWidth: 640,
openHeight: 350
)
XCTAssertGreaterThan(estimate.bytes, 0)
}
}