diff --git a/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs b/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs index 19076a17..7495aadd 100644 --- a/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs +++ b/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs @@ -75,5 +75,13 @@ internal async Task OpenDisplayHotkeysAsync() await MenuButton.ClickAsync(); await _page.GetByText("Hotkeys").ClickAsync(); } + + internal async Task ResetCuesheetAsync() + { + await MenuButton.ClickAsync(); + await _page.GetByRole(AriaRole.Menuitem, new() { Name = "Reset" }).ClickAsync(); + await _page.GetByText("Reset cuesheet").ClickAsync(); + await _page.GetByRole(AriaRole.Button, new() { Name = "Yes" }).ClickAsync(); + } } } diff --git a/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs b/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs index 29d0a26f..874a59b2 100644 --- a/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs +++ b/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs @@ -61,6 +61,18 @@ public async Task OpenSettings_ShouldDisplaySettings_WhenSelectingSettings() await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Settings" })).ToBeVisibleAsync(); } + [TestMethod] + public async Task ResetCuesheet_ShouldResetAllCuesheetReferences_WhenResettingCuesheetAsync() + { + var bar = new AppBar(TestPage); + var detailView = new DetailView(TestPage); + await detailView.GotoAsync(); + await detailView.AddAudiofileAsync(); + await detailView.SetAudiofileInputFileAsync(0, "Kalimba.mp3"); + await bar.ResetCuesheetAsync(); + await Expect(TestPage.GetByRole(AriaRole.Tabpanel, new() { Name = "Detail view" })).ToMatchAriaSnapshotAsync("- group:\n - paragraph: \"--:--:--\"\n - slider \"Playback slider\" [disabled]: \"0\"\n - paragraph: \"--:--:--\"\n- group:\n - button \"Play\" [disabled]\n - group:\n - button \"Jump to previous track\" [disabled]\n - button \"Stop the current playback\" [disabled]\n - button \"Jump to next track\" [disabled]"); + } + [TestMethod] public async Task ChangeLanguage_ShouldSwitchLanguage_WhenGermanIsSelected() { diff --git a/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs b/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs index 47ed8465..eb0bf1b6 100644 --- a/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs +++ b/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs @@ -63,6 +63,18 @@ public async Task OpenSettings_ShouldDisplaySettings_WhenSelectingSettings() await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Settings" })).ToBeVisibleAsync(); } + [TestMethod] + public async Task ResetCuesheet_ShouldResetAllCuesheetReferences_WhenResettingCuesheetAsync() + { + var bar = new AppBar(TestPage); + var detailView = new DetailView(TestPage); + await detailView.GotoAsync(); + await detailView.AddAudiofileAsync(); + await detailView.SetAudiofileInputFileAsync(0, "Kalimba.mp3"); + await bar.ResetCuesheetAsync(); + await Expect(TestPage.GetByRole(AriaRole.Tabpanel, new() { Name = "Detail view" })).ToMatchAriaSnapshotAsync("- group:\n - paragraph: \"--:--:--\"\n - slider \"Playback slider\" [disabled]: \"0\"\n - paragraph: \"--:--:--\"\n- group:\n - button \"Play\" [disabled]\n - group:\n - button \"Jump to previous track\" [disabled]\n - button \"Stop the current playback\" [disabled]\n - button \"Jump to next track\" [disabled]"); + } + [TestMethod] public async Task ChangeLanguage_ShouldSwitchLanguage_WhenGermanIsSelected() { diff --git a/AudioCuesheetEditor/Services/Audio/PlaybackService.cs b/AudioCuesheetEditor/Services/Audio/PlaybackService.cs index 2bd6d2f5..c27c0c2c 100644 --- a/AudioCuesheetEditor/Services/Audio/PlaybackService.cs +++ b/AudioCuesheetEditor/Services/Audio/PlaybackService.cs @@ -92,6 +92,7 @@ void AudiofileManager_AudiofileChanged(object? sender, Audiofile audiofile) void SessionStateContainer_CuesheetChanged(object? sender, EventArgs e) { _ = StopAsync(); + CurrentPositionChanged?.Invoke(); } public async Task PlayOrPauseAsync() diff --git a/AudioCuesheetEditor/Shared/AppBar.razor b/AudioCuesheetEditor/Shared/AppBar.razor index 4fad7e10..392f6c76 100644 --- a/AudioCuesheetEditor/Shared/AppBar.razor +++ b/AudioCuesheetEditor/Shared/AppBar.razor @@ -82,8 +82,8 @@ along with Foobar. If not, see @if (DisplayReset) { - @_localizer["Reset cuesheet"] - @_localizer["Reset application"] + @_localizer["Reset cuesheet"] + @_localizer["Reset application"] }