将 otg_swift OTG 引擎迁入 Core/CameraOTG,并接入旅拍有线传图与历史导入。

恢复 USB 相机连接、边拍边传、三品牌驱动与 SwiftUI 历史导入页,通过适配层对接现有本地上传与 OSS 管道。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 11:22:07 +08:00
parent d7fec35715
commit be9c844bd3
50 changed files with 5721 additions and 20 deletions

View File

@ -0,0 +1,95 @@
//
// PlatformDetectorTests.swift
// suixinkanTests
//
import XCTest
@testable import suixinkan
/// PlatformDetector USB VID
final class PlatformDetectorTests: XCTestCase {
/// Sony USB Vendor ID
func testDetectSonyByVendorID() {
let info = CameraDeviceInfo(
name: "USB Device",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: 0x054C,
usbProductID: 0x1234
)
XCTAssertEqual(PlatformDetector.detect(from: info), .sony)
}
/// Canon USB Vendor ID
func testDetectCanonByVendorID() {
let info = CameraDeviceInfo(
name: "USB Device",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: 0x04A9,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: info), .canon)
}
/// Nikon USB Vendor ID
func testDetectNikonByVendorID() {
let info = CameraDeviceInfo(
name: "USB Device",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: 0x04B0,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: info), .nikon)
}
/// VID
func testDetectByDeviceNameKeyword() {
let sony = CameraDeviceInfo(
name: "ILCE-7M4",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: nil,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: sony), .sony)
let canon = CameraDeviceInfo(
name: "Canon EOS R5",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: nil,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: canon), .canon)
let nikon = CameraDeviceInfo(
name: "Nikon Z 8",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: nil,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: nikon), .nikon)
}
/// unknown
func testDetectUnknownWhenNoMatch() {
let info = CameraDeviceInfo(
name: "Generic Webcam",
manufacturer: nil,
model: nil,
serialNumber: nil,
usbVendorID: nil,
usbProductID: nil
)
XCTAssertEqual(PlatformDetector.detect(from: info), .unknown)
}
}