Files
downterm/CommandNotch/CommandNotchTests/TerminalScrollbackEstimatorTests.swift

35 lines
987 B
Swift

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)
}
}