Skip to content
Permalink
Browse files

Fix voiceover tests

  • Loading branch information
GianniCarlo committed Feb 17, 2020
1 parent 036b2a7 commit ca688b9ece9ad8b42f4c8316377357d762a0fae9
@@ -154,8 +154,8 @@
"voiceover_unknown_author" = "Unknown author";
"voiceover_book_info" = "%@ by %@";
"voiceover_book_chapter" = "%@ by %@, chapter %@";
"voiceover_rewind_time" = "Rewind %d";
"voiceover_forward_time" = "Fast Forward %d";
"voiceover_rewind_time" = "Rewind %@";
"voiceover_forward_time" = "Fast Forward %@";
"watchapp_last_played_title" = "Last Played";
"watchapp_refresh_data_title" = "Refresh data";
"carplay_recent_title" = "Recent";
@@ -154,8 +154,8 @@
"voiceover_unknown_author" = "Unknown author";
"voiceover_book_info" = "%@ by %@";
"voiceover_book_chapter" = "%@ by %@, chapter %@";
"voiceover_rewind_time" = "Rewind %d";
"voiceover_forward_time" = "Fast Forward %d";
"voiceover_rewind_time" = "Rewind %@";
"voiceover_forward_time" = "Fast Forward %@";
"watchapp_last_played_title" = "Last Played";
"watchapp_refresh_data_title" = "Refresh data";
"carplay_recent_title" = "Recent";
@@ -9,23 +9,30 @@ class VoiceOverServiceTest: XCTestCase {

func testRewindText() {
PlayerManager.shared.rewindInterval = 60
XCTAssert(VoiceOverService.rewindText() == "Rewind 1 minute")

let localizedString = String(describing: String.localizedStringWithFormat("voiceover_rewind_time".localized, VoiceOverService.secondsToMinutes(PlayerManager.shared.rewindInterval.rounded())))

XCTAssert(VoiceOverService.rewindText() == localizedString)
}

func testForwardText() {
PlayerManager.shared.forwardInterval = 60
XCTAssert(VoiceOverService.fastForwardText() == "Fast Forward 1 minute")

var localizedString = String(describing: String.localizedStringWithFormat("voiceover_forward_time".localized, VoiceOverService.secondsToMinutes(PlayerManager.shared.forwardInterval.rounded())))

XCTAssert(VoiceOverService.fastForwardText() == localizedString)

PlayerManager.shared.forwardInterval = 90
XCTAssert(VoiceOverService.fastForwardText() == "Fast Forward 1 minute 30 seconds")

localizedString = String(describing: String.localizedStringWithFormat("voiceover_forward_time".localized, VoiceOverService.secondsToMinutes(PlayerManager.shared.forwardInterval.rounded())))

XCTAssert(VoiceOverService.fastForwardText() == localizedString)

PlayerManager.shared.forwardInterval = 120
XCTAssert(VoiceOverService.fastForwardText() == "Fast Forward 2 minutes")
}

func testSecondsToMinutes() {
XCTAssert(VoiceOverService.secondsToMinutes(7952) == "2 hours 12 minutes 32 seconds")
XCTAssert(VoiceOverService.secondsToMinutes(3661) == "1 hour 1 minute 1 second")
localizedString = String(describing: String.localizedStringWithFormat("voiceover_forward_time".localized, VoiceOverService.secondsToMinutes(PlayerManager.shared.forwardInterval.rounded())))

XCTAssert(VoiceOverService.fastForwardText() == localizedString)
}

func testPerformanceExample() {

0 comments on commit ca688b9

Please sign in to comment.
You can’t perform that action at this time.