Cotton code
61 lines · 2.6 KB · SwiftRaw
// Pictures and voice notes a conversation ALREADY CARRIES: the paper chat's// rules, the gallery's counter, and both directions of the widened media entry.//// The composer's half of this file — the stager, the tray and the camera gate// — went with the multi-person sharing data plane, which is what `send_message`// and `capture.messageMedia` belonged to (the code is on the branch// `archive/sharing-v1`). What is left reads an IMPORTED archive: a WhatsApp or// iMessage thread carries pictures, and drawing them is the phone's alone.//// NOT HELD — the tiles themselves, the pinch, the pager and the// drag-to-dismiss. Presentation, layout and animation are verified on// TestFlight per the repo's own line; what a test can hold about them is the// pure decision underneath, which is what `ChatPaper` and `indexLabel` are.//// Every fixture is SYNTHETIC: invented keys, invented names, invented paths.//// The boundary's shapes are JSON now, so what used to be a decoder test is a// test of the row's own reader: `MessageMedia(_:)` and `ThreadMessage(_:)` over// a `JSONValue` the crate could have answered.import CoreGraphicsimport CottonKit#if canImport(UIKit)import UIKit#endifimport XCTest@testable import CottonUI// MARK: - The paper chat's rules// `ChatPaper` is plain, but `MessageMedia` is read beside `@MainActor` statics// here, so the class stays a main-actor one like its neighbours.@MainActorfinal class ChatPaperTests: XCTestCase {    // ── Which paper a note is written on ─────────────────────────────────    // ── When a message is a letter ───────────────────────────────────────    // ── Several photographs ──────────────────────────────────────────────    /// A film keeps a typed line on its note; a picture is a print.    func testWhatCountsAsAPicture() {        XCTAssertTrue(MessageMedia(contentType: "image/heic").isImage)        XCTAssertTrue(MessageMedia(contentType: "", kind: "image").isImage)        XCTAssertFalse(MessageMedia(contentType: "video/quicktime").isImage)        // The STATED kind outranks the content type, both ways round.        XCTAssertFalse(MessageMedia(contentType: "image/jpeg", kind: "file").isImage)        XCTAssertFalse(MessageMedia(contentType: "audio/mp4", kind: "voice").isImage)        XCTAssertFalse(MessageMedia(contentType: "application/pdf").isImage)    }}// MARK: - The widened entry, both directions