Skip to content

Commit

Permalink
Timecode.StringFormat: Deprecated redundant showSubFrames static …
Browse files Browse the repository at this point in the history
…constructor
  • Loading branch information
orchetect committed Oct 21, 2024
1 parent 736b8e0 commit b2ab872
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ extension Timecode {
stringValueVerbose
}
}

extension Timecode.StringFormat {
@available(*, deprecated, message: "Use [.showSubFrames] instead.")
public static let showSubFrames: Self = [.showSubFrames]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ extension Timecode.StringFormat {
public static func `default`() -> Self {
[]
}

/// Initialize with Show Subframes option enabled.
public static let showSubFrames: Self = [.showSubFrames]
}

extension Timecode.StringFormat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ final class Timecode_Source_String_Tests: XCTestCase {
let t = item.numberOfDigits == 2 ? "" : "0"

// still produces days since we have not clamped it yet
var sv = tc.stringValue(format: .showSubFrames)
var sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "2 01:02:03:\(t)04.12", "for \(item)")

// now omits days since our limit is 24hr and clamped
tc.clampComponents()
sv = tc.stringValue(format: .showSubFrames)
sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "01:02:03:\(t)04.12", "for \(item)")
}

Expand All @@ -245,12 +245,12 @@ final class Timecode_Source_String_Tests: XCTestCase {
let t = item.numberOfDigits == 2 ? "" : "0"

// still produces days since we have not clamped it yet
var sv = tc.stringValue(format: .showSubFrames)
var sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "2 01:02:03;\(t)04.12", "for \(item)")

// now omits days since our limit is 24hr and clamped
tc.clampComponents()
sv = tc.stringValue(format: .showSubFrames)
sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "01:02:03;\(t)04.12", "for \(item)")
}

Expand All @@ -263,7 +263,7 @@ final class Timecode_Source_String_Tests: XCTestCase {

let t = item.numberOfDigits == 2 ? "" : "0"

let sv = tc.stringValue(format: .showSubFrames)
let sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "2 01:02:03:\(t)04.12", "for \(item)")
}

Expand All @@ -274,7 +274,7 @@ final class Timecode_Source_String_Tests: XCTestCase {

let t = item.numberOfDigits == 2 ? "" : "0"

let sv = tc.stringValue(format: .showSubFrames)
let sv = tc.stringValue(format: [.showSubFrames])
XCTAssertEqual(sv, "2 01:02:03;\(t)04.12", "for \(item)")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class Timecode_init_Tests: XCTestCase {

let frSep = item.isDrop ? ";" : ":"

XCTAssertEqual(tc.stringValue(format: .showSubFrames), "00:00:00\(frSep)\(frm).00")
XCTAssertEqual(tc.stringValue(format: [.showSubFrames]), "00:00:00\(frSep)\(frm).00")
}
}
}

0 comments on commit b2ab872

Please sign in to comment.