Cotton code
45 lines · 2.5 KB · SwiftRaw
// Words' Look (shared/DECISIONS.md "Look"): the chosen light and dark papers stand ringed (selected) and change// with a tap on a half; the ink, the face and the size follow a tap; Reset asks first and brings back the defaults// (Linen, Slate, Blue, Figtree, 17); choices carry over a relaunch. More holds line spacing, line width and hide// marks. At the largest text Reset is still reached. Only selection, reset and carry-over: no test per look.import XCTestfinal class NotesLookTests: XCTestCase {    override func setUp() { continueAfterFailure = false }    @MainActor private static func open(_ extra: [String] = []) -> XCUIApplication {        let app = NotesUI.launch(["-notes-open", "settings"] + extra)        let row = LookUI.id(app, "settings-row-look")        XCTAssertTrue(row.waitForExistence(timeout: 60), "Look stands in Settings")        row.tap()        return app    }    private let look = LookCase(open: { NotesLookTests.open() },                                defaults: (light: "linen", dark: "slate", ink: "blue", face: "own", size: "17"),                                other: (light: "print", dark: "dusk", ink: "green", face: "serif"),                                resetAct: "notes-act-reset")    // RULE: each half, the ink, the face and the size follow a tap; Reset asks first and brings the defaults back.    @MainActor func testSelectionAndReset() { look.selectionAndReset() }    // RULE: a choice stands after the app opens again.    @MainActor func testCarryOver() { look.carryOver() }    // RULE (owner, 23 Nov 2026: "choosing a font changes nothing" on his iPhone): a face chosen reaches the drawn words    // and stands when the app opens again, also on a server deployed before Look.    @MainActor func testPaperRowsAndTheSample() { look.paperRowsAndTheSample() }    @MainActor func testAFaceReachesTheWords() { look.faceReachesTheWords({ NotesLookTests.open($0) }) }    // RULE: More holds line spacing, line width and hide marks; at the largest text Reset is still reached.    @MainActor func testMoreAndTheLargestText() {        look.largestText { NotesLookTests.open(NotesUI.largestText) }        let hide = LookUI.id(XCUIApplication(), "settings-hide-marks")        XCTAssertTrue(hide.waitForExistence(timeout: 10), "hide marks stands under More")    }    // The quick look: each paper and each face on the app's first screen, kept as attachments (no assertion per look).    @MainActor func testQuickLook() { look.quickLook { NotesUI.launch(["-notes-open", "note"]) } }}