Cotton code
41 lines · 2.1 KB · SwiftRaw
import CottonKit@testable import CottonUIimport XCTest/// Days launches on its own colour from the first frame to its first day:/// the splash the app paints after the launch screen is the same flat/// colour (flavour.json `flat`), never the shell's paper (`blank`) it once/// laid, a cream page between the launch screen and today (21 Nov 2026).final class DaysSplashTests: XCTestCase {    private func manifest(_ flavour: String) throws -> FlavourManifest {        try JSONDecoder().decode(FlavourManifest.self, from: Data(            try SourceSweep.mustRead("apps/cotton/App/Flavours/\(flavour)/flavour.json", ownedBy: "days").utf8))    }    // RULE: a flat app on the shell's paper (Days, Story, Meetings) splashes on its own flat colour; one with a real ground (Keys' leather) keeps it; Notes keeps its theme's, and Cotton its plaster.    func testAFlatAppsSplashIsItsOwnColour() throws {        let days = try manifest("days")        XCTAssertTrue(days.flat, "Days launches flat")        for flavour in ["days", "story", "meetings"] {            let flat = try manifest(flavour)            XCTAssertEqual(SplashGround.of(notes: false, manifest: flat, face: FaceGround.launched(by: flat)), .flat, flavour)        }        let keys = try manifest("keys")        let leather = try XCTUnwrap(FaceGround.launched(by: keys))        XCTAssertEqual(SplashGround.of(notes: false, manifest: keys, face: leather), .face(leather))        XCTAssertEqual(SplashGround.of(notes: true, manifest: try manifest("notes"), face: nil), .notes)        XCTAssertEqual(SplashGround.of(notes: false, manifest: nil, face: nil), .plaster)    }}#if os(iOS)import SwiftUI/// RULE (launch-ios walk, 22 Nov 2026): the Days · Sometime switch stops growing at the largest size below the accessibility sizes, so at the largest text "Sometime" never runs under the "+".final class DaysSwitchSizeTests: XCTestCase {    func testTheSwitchIsHeldBelowTheAccessibilitySizes() {        XCTAssertFalse(DaysKnobs.switchLargest.isAccessibilitySize)        XCTAssertEqual(DaysKnobs.switchLargest, .xxxLarge)    }}#endif