public void TestStartStop() { PreviewTrack track = null; AddStep("get track", () => track = getOwnedTrack()); AddStep("start", () => track.Start()); AddAssert("started", () => track.IsRunning); AddStep("stop", () => track.Stop()); AddAssert("stopped", () => !track.IsRunning); }
public void TestEnsureMutingCorrectly(bool stopAnyPlaying) { PreviewTrack track = null; TestTrackOwner owner = null; AddStep("ensure volume not zero", () => { if (audio.Volume.Value == 0) { audio.Volume.Value = 1; } if (audio.VolumeTrack.Value == 0) { audio.VolumeTrack.Value = 1; } }); AddAssert("game not muted", () => audio.Tracks.AggregateVolume.Value != 0); AddStep("get track", () => Add(owner = new TestTrackOwner(track = getTrack()))); AddUntilStep("wait loaded", () => track.IsLoaded); AddStep("start track", () => track.Start()); AddAssert("game is muted", () => audio.Tracks.AggregateVolume.Value == 0); if (stopAnyPlaying) { AddStep("stop any playing", () => trackManager.StopAnyPlaying(owner)); } else { AddStep("stop track", () => track.Stop()); } AddAssert("game not muted", () => audio.Tracks.AggregateVolume.Value != 0); }
private void stopPreview() { toggleLoading(false); Playing.Value = false; previewTrack?.Stop(); }