-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathPhotosTests.swift
42 lines (37 loc) · 1.52 KB
/
PhotosTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// RUN: %target-typecheck-verify-swift
// REQUIRES: objc_interop
// UNSUPPORTED: OS=watchos
// UNSUPPORTED: OS=macosx
import Photos
if #available(iOS 8.0, tvOS 10.0, *) {
// compile time only validation test for the SDK overlay,
// because PHChange pretty much requires a GUI app
struct GenericPHChangeTest {
let asset: PHAsset!
let collection: PHAssetCollection!
let list: PHCollectionList!
let assetsFetch: PHFetchResult<PHAsset>!
let collectionsFetch: PHFetchResult<PHAssetCollection>!
let listsFetch: PHFetchResult<PHCollectionList>!
func testPHChange(change: PHChange) {
let assetDetails: PHObjectChangeDetails<PHAsset>?
= change.changeDetails(for: asset)
let collectionDetails: PHObjectChangeDetails<PHAssetCollection>?
= change.changeDetails(for: collection)
let listDetails: PHObjectChangeDetails<PHCollectionList>?
= change.changeDetails(for: list)
let assetsFetchDetails: PHFetchResultChangeDetails<PHAsset>?
= change.changeDetails(for: assetsFetch)
let collectionsFetchDetails: PHFetchResultChangeDetails<PHAssetCollection>?
= change.changeDetails(for: collectionsFetch)
let listsFetchDetails: PHFetchResultChangeDetails<PHCollectionList>?
= change.changeDetails(for: listsFetch)
assert(assetDetails != nil)
assert(collectionDetails != nil)
assert(listDetails != nil)
assert(assetsFetchDetails != nil)
assert(collectionsFetchDetails != nil)
assert(listsFetchDetails != nil)
}
}
}