引入进程级 CameraTetheringSession 与共享 USB Browser;离开传图页仅取消 UI 回调,App 终止时再完整 shutdown 释放 PTP 与 Browser 资源。 Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
841 B
Swift
26 lines
841 B
Swift
//
|
||
// USBDeviceBrowserControllerTests.swift
|
||
// suixinkanTests
|
||
//
|
||
|
||
import XCTest
|
||
@testable import suixinkan
|
||
|
||
/// USB 设备浏览器 teardown 行为测试。
|
||
final class USBDeviceBrowserControllerTests: XCTestCase {
|
||
/// 测试 stop 后重置授权缓存与 stopped 标记,便于再次进入页面时重新申请权限。
|
||
func testStopResetsAuthorizationAndStoppedFlag() {
|
||
let controller = USBDeviceBrowserController()
|
||
controller.stop()
|
||
|
||
XCTAssertTrue(controller.isStoppedForTesting)
|
||
XCTAssertFalse(controller.isAuthorizationGrantedForTesting)
|
||
}
|
||
|
||
/// 测试断开标记可被再次进入时的 re-enumerate 逻辑读取。
|
||
func testReconnectHintMarksAndExpires() {
|
||
USBCameraReconnectHint.markDisconnected()
|
||
XCTAssertTrue(USBCameraReconnectHint.shouldReEnumerate)
|
||
}
|
||
}
|