WIP: add color clip support

This commit is contained in:
Akshay Kolli
2026-07-01 14:52:54 -07:00
parent d22c0c23ec
commit c9ef1d5e84
15 changed files with 377 additions and 17 deletions

View File

@@ -83,6 +83,30 @@ final class PasteActionServiceTests: XCTestCase {
)
}
func testCopyWritesColorToPasteboardWithHexFallback() throws {
let service = PasteActionService()
let item = ClipboardItem(
id: UUID(),
kind: .color,
displayText: "#0A84FF",
payload: "#0A84FF",
payloadHash: "hash",
createdAt: Date(),
lastUsedAt: Date(),
useCount: 0,
sourceApp: nil,
imagePath: nil,
thumbnailPath: nil
)
XCTAssertEqual(service.copy(item), .copied)
let restored = try XCTUnwrap(NSColor(from: NSPasteboard.general))
XCTAssertEqual(ColorPayload.hexString(from: restored), "#0A84FF")
XCTAssertEqual(NSPasteboard.general.string(forType: .string), "#0A84FF")
XCTAssertEqual(service.copyPlainText(item), .copiedPlainText)
XCTAssertEqual(NSPasteboard.general.string(forType: .string), "#0A84FF")
}
func testPasteWithoutTargetCopiesWithoutRequestingAutomaticPaste() {
let service = PasteActionService()
let item = ClipboardItem(