mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 20:01:39 +00:00
* fix(ios): add Photos permission controls * chore(i18n): sync native Photos strings * fix(ios): align Swedish Photos disclosure * test(ios): complete limited Photos UI proof * chore(i18n): refresh native source lines
40 lines
1.3 KiB
Swift
40 lines
1.3 KiB
Swift
import Photos
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@Suite(.serialized) struct PermissionRequestBridgeTests {
|
|
@Test func `box resumes immediately when cancelled before install`() async {
|
|
let box = PermissionRequestBridge.Box()
|
|
box.resume(false)
|
|
let granted: Bool = await withCheckedContinuation { continuation in
|
|
_ = box.install(continuation)
|
|
}
|
|
#expect(granted == false)
|
|
#expect(box.canStartRequest() == false)
|
|
}
|
|
|
|
@Test func `box resumes installed continuation once`() async {
|
|
let box = PermissionRequestBridge.Box()
|
|
|
|
let granted: Bool = await withCheckedContinuation { continuation in
|
|
_ = box.install(continuation)
|
|
box.resume(true)
|
|
box.resume(false)
|
|
}
|
|
|
|
#expect(granted == true)
|
|
}
|
|
}
|
|
|
|
struct PhotoLibraryAccessTests {
|
|
@Test(arguments: [PHAuthorizationStatus.authorized, .limited])
|
|
func `read access includes full and limited authorization`(_ status: PHAuthorizationStatus) {
|
|
#expect(PhotoLibraryAccess.canRead(status))
|
|
}
|
|
|
|
@Test(arguments: [PHAuthorizationStatus.notDetermined, .denied, .restricted])
|
|
func `read access excludes unavailable authorization`(_ status: PHAuthorizationStatus) {
|
|
#expect(!PhotoLibraryAccess.canRead(status))
|
|
}
|
|
}
|