@@ -20,66 +20,33 @@ final class testTimeline: XCTestCase {
2020 override func tearDownWithError( ) throws {
2121 }
2222
23- func testMetadataRead( ) {
24- let inputName = " data/timeline.otio "
23+ func testMetadataRead( ) throws {
2524 let knownDictKey = " foo "
2625 let knownKey = " some_key "
2726 let knownValue = " some_value "
2827
29- guard let timelineInputPath = Bundle . module. path ( forResource: inputName, ofType: " " ) else {
30- XCTFail ( " Missing test data ` \( inputName) ` " )
31- return
32- }
28+ let timeline = try timeline ( from: " data/timeline.otio " )
29+ let timelineMetadata = timeline. metadata
3330
34- do {
35- let otio = try SerializableObject . fromJSON ( filename: timelineInputPath)
36-
37- guard let timeline = otio as? Timeline else {
38- XCTFail ( " Could not create Timeline object from \( timelineInputPath) " )
39- return
40- }
41-
42- let timelineMetadata = timeline. metadata
43-
44- if let knownMetadata = timelineMetadata [ knownDictKey] as? Metadata . Dictionary {
45- if let value = knownMetadata [ knownKey] as? String {
46- XCTAssertTrue ( value == knownValue)
47- } else {
48- XCTFail ( " Expects ( \( knownKey) , \( knownValue) ), but found none in \( knownMetadata) " )
49- }
31+ if let knownMetadata = timelineMetadata [ knownDictKey] as? Metadata . Dictionary {
32+ if let value = knownMetadata [ knownKey] as? String {
33+ XCTAssertTrue ( value == knownValue)
5034 } else {
51- XCTFail ( " Cannot read timeline metadata \( String ( describing : timelineMetadata [ knownDictKey ] ) ) as `Metadata.Dictionary` " )
35+ XCTFail ( " Expects ( \( knownKey ) , \( knownValue ) ), but found none in \( knownMetadata ) " )
5236 }
53- } catch let error {
54- XCTFail ( " Cannot read OTIO file ` \( timelineInputPath ) `: \( error ) " )
37+ } else {
38+ XCTFail ( " Cannot read timeline metadata \( String ( describing : timelineMetadata [ knownDictKey ] ) ) as `Metadata.Dictionary` " )
5539 }
5640 }
5741
58- func testTimelineClipAvailableBounds( ) {
59- let inputName = " data/clip_example.otio "
42+ func testTimelineClipAvailableBounds( ) throws {
43+ let timeline = try timeline ( from : " data/clip_example.otio " )
6044
61- guard let timelineInputPath = Bundle . module. path ( forResource: inputName, ofType: " " ) else {
62- XCTFail ( " Missing test data ` \( inputName) ` " )
63- return
64- }
65-
66- do {
67- let otio = try SerializableObject . fromJSON ( filename: timelineInputPath)
68-
69- guard let timeline = otio as? Timeline else {
70- XCTFail ( " Could not create Timeline object from \( timelineInputPath) " )
71- return
72- }
73-
74- if let firstClip = timeline. videoTracks. first!. children [ 1 ] as? Clip ,
75- let mediaReference = firstClip. mediaReference,
76- let availableBounds = mediaReference. availableImageBounds
77- {
78- XCTAssertEqual ( availableBounds, CGRect ( origin: . zero, size: CGSize ( width: 16 , height: 9 ) ) )
79- }
80-
81- } catch let error {
82- XCTFail ( " Cannot read OTIO file ` \( timelineInputPath) `: \( error) " )
45+ if let firstClip = timeline. videoTracks. first!. children [ 1 ] as? Clip ,
46+ let mediaReference = firstClip. mediaReference,
47+ let availableBounds = mediaReference. availableImageBounds
48+ {
49+ XCTAssertEqual ( availableBounds, CGRect ( origin: . zero, size: CGSize ( width: 16 , height: 9 ) ) )
8350 }
8451 }
8552
0 commit comments