Kartenimport, Metadaten und Versand absichern
This commit is contained in:
1 parent
be6bd49da5
commit
427b6fa7b0
18 files changed
+643
-193
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import LichtkastenCore
|
||||
|
||||
final class DeliveryTests: XCTestCase {
|
||||
func testMinimumEdgeUsesTheFileOnDisk() throws {
|
||||
let file = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".png")
|
||||
let image = try XCTUnwrap(Data(base64Encoded: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jS0sAAAAASUVORK5CYII="))
|
||||
try image.write(to: file)
|
||||
defer { try? FileManager.default.removeItem(at: file) }
|
||||
|
||||
var options = PreflightOptions()
|
||||
options.requiredFields = []
|
||||
options.minLongEdge = 2
|
||||
let issues = Preflight.check(iptc: IPTCValues(), exif: ["ImageWidth": "4000", "ImageHeight": "3000"],
|
||||
captureDate: nil, codes: CodeReplacements(), options: options,
|
||||
uploadFiles: [file])
|
||||
XCTAssertEqual(issues.count, 1)
|
||||
XCTAssertEqual(issues.first?.severity, .error)
|
||||
XCTAssertTrue(issues.first?.message.contains("1 px") == true)
|
||||
}
|
||||
|
||||
func testExportResultKeepsOriginalPathForEachJPEG() {
|
||||
let result = LightroomJobResult.parse("""
|
||||
exported=/sent/DSC_0001-2.jpg
|
||||
source=/raw/DSC_0001-2.nef
|
||||
exported=/sent/DSC_0001-3.jpg
|
||||
source=/raw/DSC_0001.nef
|
||||
exported=/sent/legacy.jpg
|
||||
""")
|
||||
XCTAssertEqual(result.exportSources[URL(fileURLWithPath: "/sent/DSC_0001-2.jpg")]?.path,
|
||||
"/raw/DSC_0001-2.nef")
|
||||
XCTAssertEqual(result.exportSources[URL(fileURLWithPath: "/sent/DSC_0001-3.jpg")]?.path,
|
||||
"/raw/DSC_0001.nef")
|
||||
XCTAssertNil(result.exportSources[URL(fileURLWithPath: "/sent/legacy.jpg")])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user