mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-29 14:47:21 +02:00
fix: Negative currentTime after seek back
This commit is contained in:
@@ -16,6 +16,13 @@ final class PlayerTimeUtilsTests: XCTestCase {
|
||||
let lastPlayedMs = threeSecondsAgo.timeIntervalSince1970 * 1000
|
||||
XCTAssertEqual(PlayerTimeUtils.calcSeekBackTime(currentTime: currentTime, lastPlayedMs: lastPlayedMs), 998)
|
||||
}
|
||||
|
||||
func testCalcSeekBackTimeWithZeroCurrentTime() {
|
||||
let currentTime: Double = 0
|
||||
let threeHundredSecondsAgo = Date(timeIntervalSinceNow: -300)
|
||||
let lastPlayedMs = threeHundredSecondsAgo.timeIntervalSince1970 * 1000
|
||||
XCTAssertEqual(PlayerTimeUtils.calcSeekBackTime(currentTime: currentTime, lastPlayedMs: lastPlayedMs), 0)
|
||||
}
|
||||
|
||||
func testTimeSinceLastPlayed() throws {
|
||||
let fiveSecondsAgo = Date(timeIntervalSinceNow: -5)
|
||||
|
||||
Reference in New Issue
Block a user