@@ -13,12 +13,12 @@ class Timecode_Conversion_Tests: XCTestCase {
13
13
override func setUp( ) { }
14
14
override func tearDown( ) { }
15
15
16
- func testConverted ( ) throws {
16
+ func testConverted_NewFrameRate ( ) throws {
17
17
// baseline check:
18
18
// ensure conversion produces identical output if frame rates are equal
19
19
20
20
try TimecodeFrameRate . allCases. forEach {
21
- let tc = try Timecode ( . components( h: 1 ) , at: $0)
21
+ let tc = try Timecode ( . components( h: 1 ) , at: $0, base : . max100SubFrames )
22
22
23
23
let convertedTC = try tc. converted ( to: $0)
24
24
@@ -35,10 +35,41 @@ class Timecode_Conversion_Tests: XCTestCase {
35
35
. converted ( to: . fps30)
36
36
37
37
XCTAssertEqual ( convertedTC. frameRate, . fps30)
38
+ XCTAssertEqual ( convertedTC. subFramesBase, . max100SubFrames)
38
39
XCTAssertEqual ( convertedTC. components, Timecode . Components ( h: 1 , m: 00 , s: 03 , f: 18 , sf: 00 ) )
39
40
}
40
41
41
- func testConverted_PreservingValues( ) throws {
42
+ func testConverted_NewFrameRate_NewSubFramesBaseA( ) throws {
43
+ // spot-check an example conversion
44
+
45
+ let convertedTC = try Timecode (
46
+ . components( sf: 50 ) ,
47
+ at: . fps30,
48
+ base: . max100SubFrames
49
+ )
50
+ . converted ( to: . fps60, base: . max80SubFrames)
51
+
52
+ XCTAssertEqual ( convertedTC. frameRate, . fps60)
53
+ XCTAssertEqual ( convertedTC. subFramesBase, . max80SubFrames)
54
+ XCTAssertEqual ( convertedTC. components, Timecode . Components ( f: 1 ) )
55
+ }
56
+
57
+ func testConverted_NewFrameRate_NewSubFramesBaseB( ) throws {
58
+ // spot-check an example conversion
59
+
60
+ let convertedTC = try Timecode (
61
+ . components( h: 1 , sf: 40 ) ,
62
+ at: . fps23_976,
63
+ base: . max80SubFrames
64
+ )
65
+ . converted ( to: . fps30, base: . max100SubFrames)
66
+
67
+ XCTAssertEqual ( convertedTC. frameRate, . fps30)
68
+ XCTAssertEqual ( convertedTC. subFramesBase, . max100SubFrames)
69
+ XCTAssertEqual ( convertedTC. components, Timecode . Components ( h: 1 , m: 00 , s: 03 , f: 18 , sf: 62 ) )
70
+ }
71
+
72
+ func testConverted_NewFrameRate_PreservingValues( ) throws {
42
73
// baseline check:
43
74
// ensure conversion produces identical output if frame rates are equal
44
75
0 commit comments