Files
sharpemu/tests/SharpEmu.Libs.Tests/VideoOut/VulkanPipelineCacheStorageTests.cs
T
Berk 2b6bd5a532 Sdl backend (#670)
* [audio] added sdl audio backend and in-tree atrac9 decoder

* [input] replaced per-platform pad readers with sdl gamepad input

* [video] added sdl window and host display plumbing

* [gui] added host display options and per-game render settings

* [bink] synced host movie playback to the guest audio clock

* [cpu] hooked windows write faults into guest image tracking

* [perf] added guest and render profiling, reserved host cpu lanes

* [kernel] fixed stale pthread mutex handle alias

* [host] wired the sdl session, save-data paths and project references

* [audio] hoisted ajm trace stackalloc out of its loop

* [video] Add guest image sync setting

* [build] Strip native symbols

* reuse
2026-07-28 03:33:26 +03:00

75 lines
2.4 KiB
C#

// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.Libs.VideoOut;
using Xunit;
namespace SharpEmu.Libs.Tests.VideoOut;
public sealed class VulkanPipelineCacheStorageTests
{
[Fact]
public void ResolvePathUsesExecutableUserDirectoryAndTitleId()
{
var path = VulkanPipelineCacheStorage.ResolvePath("PPSA02929", configuredPath: null);
Assert.Equal(
Path.GetFullPath(Path.Combine(
AppContext.BaseDirectory,
"user",
"pipeline_cache",
"PPSA02929",
"vulkan-pipeline-cache.bin")),
path);
}
[Fact]
public void ResolvePathSanitizesTitleId()
{
var path = VulkanPipelineCacheStorage.ResolvePath("ppsa/02:929", configuredPath: null);
Assert.EndsWith(
Path.Combine("PPSA_02_929", "vulkan-pipeline-cache.bin"),
path,
StringComparison.Ordinal);
}
[Fact]
public void ResolvePathPreservesConfiguredOverride()
{
var configured = Path.Combine(Path.GetTempPath(), "SharpEmuTests", "custom-cache.bin");
Assert.Equal(
Path.GetFullPath(configured),
VulkanPipelineCacheStorage.ResolvePath("PPSA02929", configured));
}
[Fact]
public void ImportLegacyCacheDoesNotOverwriteExistingTitleCache()
{
var root = Path.Combine(Path.GetTempPath(), "SharpEmuTests", Guid.NewGuid().ToString("N"));
var legacyPath = Path.Combine(root, "legacy.bin");
var destinationPath = Path.Combine(root, "user", "pipeline_cache", "PPSA02929", "cache.bin");
try
{
Directory.CreateDirectory(root);
File.WriteAllBytes(legacyPath, [1, 2, 3]);
Assert.True(VulkanPipelineCacheStorage.ImportLegacyCache(legacyPath, destinationPath));
Assert.Equal(new byte[] { 1, 2, 3 }, File.ReadAllBytes(destinationPath));
Assert.False(File.Exists(legacyPath));
File.WriteAllBytes(legacyPath, [4, 5, 6]);
Assert.False(VulkanPipelineCacheStorage.ImportLegacyCache(legacyPath, destinationPath));
Assert.Equal(new byte[] { 1, 2, 3 }, File.ReadAllBytes(destinationPath));
}
finally
{
if (Directory.Exists(root))
{
Directory.Delete(root, recursive: true);
}
}
}
}