import XCTest @testable import CottonUI /// The marks a Clips reader honours, read off a real pasteboard. final class ClipboardMarksTests: XCTestCase { /// RULE: Cotton's own secret copy carries the concealed mark a clip reader refuses, so a vault copy never becomes a clip on any device. func testAVaultCopyIsRefusedByEveryClipReader() throws { #if canImport(AppKit) let board = NSPasteboard(name: NSPasteboard.Name("cotton-test-\(UUID())")) defer { board.releaseGlobally() } XCTAssertTrue(SystemClipboard(pasteboard: board).put("invented", expiringAfter: 5)) let types = Set(try XCTUnwrap(board.pasteboardItems?.first).types.map(\.rawValue)) XCTAssertTrue(ClipCapture.refuses(types: types)) #elseif canImport(UIKit) let board = UIPasteboard.withUniqueName() defer { UIPasteboard.remove(withName: board.name) } XCTAssertTrue(SystemClipboard(pasteboard: board).put("invented", expiringAfter: 5)) XCTAssertTrue(ClipCapture.refuses(types: Set(board.types))) #endif } }