mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Ensure files are cleaned up even on test step failure in TestAddAudioTrack
This commit is contained in:
@ -95,18 +95,23 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
string extractedFolder = $"{temp}_extracted";
|
string extractedFolder = $"{temp}_extracted";
|
||||||
Directory.CreateDirectory(extractedFolder);
|
Directory.CreateDirectory(extractedFolder);
|
||||||
|
|
||||||
using (var zip = ZipArchive.Open(temp))
|
try
|
||||||
zip.WriteToDirectory(extractedFolder);
|
{
|
||||||
|
using (var zip = ZipArchive.Open(temp))
|
||||||
|
zip.WriteToDirectory(extractedFolder);
|
||||||
|
|
||||||
bool success = setup.ChildrenOfType<ResourcesSection>().First().ChangeAudioTrack(new FileInfo(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3")));
|
bool success = setup.ChildrenOfType<ResourcesSection>().First().ChangeAudioTrack(new FileInfo(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3")));
|
||||||
|
|
||||||
File.Delete(temp);
|
// ensure audio file is copied to beatmap as "audio.mp3" rather than original filename.
|
||||||
Directory.Delete(extractedFolder, true);
|
Assert.That(Beatmap.Value.Metadata.AudioFile == "audio.mp3");
|
||||||
|
|
||||||
// ensure audio file is copied to beatmap as "audio.mp3" rather than original filename.
|
return success;
|
||||||
Assert.That(Beatmap.Value.Metadata.AudioFile == "audio.mp3");
|
}
|
||||||
|
finally
|
||||||
return success;
|
{
|
||||||
|
File.Delete(temp);
|
||||||
|
Directory.Delete(extractedFolder, true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
|
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
|
||||||
|
Reference in New Issue
Block a user