fix: always resolve video paths via GetFullPath before Uri conversion (rooted Windows paths are not absolute URIs); deadline-based CD rip/burn test polling

This commit is contained in:
John Smith
2026-09-09 18:04:14 -04:00
parent d249c692a3
commit 340d16fbc0
2 changed files with 19 additions and 6 deletions
@@ -78,10 +78,10 @@ public sealed class VideoPlaybackEngine : IVideoPlaybackEngine
lock (_gate)
{
// Windows paths and CI-relative paths are not valid absolute URIs;
// resolve to a full path first (nonexistent files still play-fail gracefully).
var mediaPath = Path.IsPathRooted(filePath) ? filePath : Path.GetFullPath(filePath);
using var media = new Media(_libVlc, new Uri(mediaPath));
// Windows paths (including rooted-but-not-drive-qualified ones like /x/y.mp4)
// are not valid absolute URIs; resolve to a full path first (nonexistent
// files still play-fail gracefully inside libVLC).
using var media = new Media(_libVlc, new Uri(Path.GetFullPath(filePath)));
_mediaPlayer.Play(media);
}
}
@@ -224,7 +224,7 @@ public class ZunePhase3FidelityTests
// Execute Rip
vm.RipCdCommand.Execute(null);
await Task.Delay(3500); // Allow async rip simulation
await WaitForCompletionAsync(() => vm.RipProgress);
Assert.Equal(1.0, vm.RipProgress);
Assert.Equal(1, sound.RipCount);
@@ -235,12 +235,25 @@ public class ZunePhase3FidelityTests
// Execute Burn
vm.BurnCdCommand.Execute(null);
await Task.Delay(3500); // Allow async burn simulation
await WaitForCompletionAsync(() => vm.BurnProgress);
Assert.Equal(1.0, vm.BurnProgress);
Assert.Equal(1, sound.BurnCount);
}
/// <summary>
/// Polls until the simulated rip/burn progress completes (or fails the deadline).
/// A fixed Task.Delay is flaky on loaded CI runners where scheduler jitter stacks up.
/// </summary>
private static async Task WaitForCompletionAsync(Func<double> progress)
{
var deadline = DateTime.UtcNow.AddSeconds(60);
while (progress() < 1.0 && DateTime.UtcNow < deadline)
{
await Task.Delay(100);
}
}
[Fact]
public void NowPlayingViewModel_KenBurnsAndMixviewAction_FunctionCorrectly()
{