Skip to content

Commit 633e205

Browse files
committed
Use TestTextureProvider in regression test
1 parent f6e1285 commit 633e205

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

tests/ImageSharp.Textures.Tests/Formats/Ktx2/Ktx2DecoderTests.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
using System.ComponentModel;
55
using SixLabors.ImageSharp.Textures.Formats.Ktx2;
6+
using SixLabors.ImageSharp.Textures.Tests.Enums;
7+
using SixLabors.ImageSharp.Textures.Tests.TestUtilities.Attributes;
8+
using SixLabors.ImageSharp.Textures.Tests.TestUtilities.TextureProviders;
69
using SixLabors.ImageSharp.Textures.TextureFormats;
710

811
namespace SixLabors.ImageSharp.Textures.Tests.Formats.Ktx2;
@@ -12,18 +15,13 @@ public class Ktx2DecoderTests
1215
{
1316
private static readonly Ktx2Decoder Ktx2Decoder = new();
1417

15-
[Fact]
18+
[Theory]
1619
[Description("Ensure that a single mipmap level does not result in an empty mipmap collection")]
17-
public void Ktx2Decoder_LevelCountZero_DecodesBaseLevelMipMap()
20+
[WithFile(TestTextureFormat.Ktx2, TestTextureType.Flat, TestTextureTool.ToKtx, TestImages.Ktx2.Rgba32SrgbMips)]
21+
public void Ktx2Decoder_LevelCountZero_DecodesBaseLevelMipMap(TestTextureProvider provider)
1822
{
19-
string path = Path.Combine(
20-
TestEnvironment.InputImagesDirectoryFullPath,
21-
"Ktx2",
22-
"Flat",
23-
"rgba32-srgb-mips.ktx2");
24-
25-
using FileStream fileStream = File.OpenRead(path);
26-
using Texture texture = Ktx2Decoder.DecodeTexture(Configuration.Default, fileStream);
23+
using Texture texture = provider.GetTexture(Ktx2Decoder);
24+
provider.SaveTextures(texture);
2725

2826
FlatTexture flatTexture = texture as FlatTexture;
2927
Assert.NotNull(flatTexture);

tests/ImageSharp.Textures.Tests/TestImages.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ public static class Ktx
1212
{
1313
public const string Rgba = "rgba8888.ktx";
1414
}
15+
16+
public static class Ktx2
17+
{
18+
public const string Rgba32SrgbMips = "rgba32-srgb-mips.ktx2";
19+
}
1520
}
1621
}
File renamed without changes.

0 commit comments

Comments
 (0)