Cotton code
28 lines · 1.3 KB · SwiftRaw
import XCTest@testable import CottonUI/// SEV 1, 5 Oct 23:15Z (architect 2335): a custom Layout between a scroll/// view and a lazy stack re-asked the lazy stack for its height and a small/// database's Home never settled. The page column states its width by the/// system's rule, the Layout keeps only content that is not lazy, and a/// tripwire holds a column that does not settle rather than lock the phone.@MainActorfinal class ScrollColumnPlacementTests: XCTestCase {    /// RULE: The tripwire trips past 20 differing heights within one second — never on a height said again, never on changes spread over seconds.    func testTheTripwireTripsOnlyOnAStorm() {        let start = Date(timeIntervalSinceReferenceDate: 0)        let storm = ColumnStorm()        for i in 1...ColumnStorm.limit {            XCTAssertFalse(storm.heard(CGFloat(100 + i), at: start.addingTimeInterval(Double(i) * 0.01)), "answer \(i)")        }        XCTAssertTrue(storm.heard(999, at: start.addingTimeInterval(0.5)), "the 21st differing height in a second")        let steady = ColumnStorm()        for i in 0..<200 { XCTAssertFalse(steady.heard(640, at: start.addingTimeInterval(Double(i) * 0.001))) }        let slow = ColumnStorm()        for i in 0..<100 { XCTAssertFalse(slow.heard(CGFloat(i), at: start.addingTimeInterval(Double(i) * 0.06))) }    }}