Skip to content

Commit 43d7db6

Browse files
committed
Project for paths
1 parent 6fb2c43 commit 43d7db6

15 files changed

Lines changed: 113 additions & 91 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace AssetRipper.TextureDecoder.Paths;
2+
3+
public static class ProjectFolders
4+
{
5+
public const string ThisProject = "../../../";
6+
public const string RepositoryRoot = ThisProject + "../";
7+
public const string TestProject = RepositoryRoot + "AssetRipper.TextureDecoder.Tests/";
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace AssetRipper.TextureDecoder.Paths;
2+
3+
public static class TestFileFolders
4+
{
5+
public const string TestFiles = ProjectFolders.RepositoryRoot + "TestFiles/";
6+
public const string AstcTestFiles = TestFiles + "Astc/";
7+
public const string AtcTestFiles = TestFiles + "Atc/";
8+
public const string BcTestFiles = TestFiles + "Bc/";
9+
public const string DxtTestFiles = TestFiles + "Dxt/";
10+
public const string EtcTestFiles = TestFiles + "Etc/";
11+
public const string PvrtcTestFiles = TestFiles + "Pvrtc/";
12+
public const string RgbTestFiles = TestFiles + "Rgb/";
13+
public const string Yuy2TestFiles = TestFiles + "Yuy2/";
14+
public const string AndroidTestFiles = TestFiles + "Android/";
15+
}

AssetRipper.TextureDecoder.Tests/AssetRipper.TextureDecoder.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20+
<ProjectReference Include="..\AssetRipper.TextureDecoder.Paths\AssetRipper.TextureDecoder.Paths.csproj" />
2021
<ProjectReference Include="..\AssetRipper.TextureDecoder\AssetRipper.TextureDecoder.csproj" />
2122
</ItemGroup>
2223

AssetRipper.TextureDecoder.Tests/AtcTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ public sealed class AtcTests
55
[Test]
66
public void DecompressAtcRgb4Test()
77
{
8-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.AtcTestFilesFolder + "test.atc_rgb4");
8+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.AtcTestFiles + "test.atc_rgb4");
99
int bytesRead = Atc.AtcDecoder.DecompressAtcRgb4(data, 256, 256, out _);
1010
Assert.That(bytesRead, Is.EqualTo(data.Length));
1111
}
1212

1313
[Test]
1414
public void DecompressAtcRgba8Test()
1515
{
16-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.AtcTestFilesFolder + "test.atc_rgba8");
16+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.AtcTestFiles + "test.atc_rgba8");
1717
int bytesRead = Atc.AtcDecoder.DecompressAtcRgba8(data, 256, 256, out _);
1818
Assert.That(bytesRead, Is.EqualTo(data.Length));
1919
}
2020
}
21-
}
21+
}

AssetRipper.TextureDecoder.Tests/BcTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public sealed class BcTests
1515
[SetUp]
1616
public void InitializeOriginalData()
1717
{
18-
originalBgra32LogoData = File.ReadAllBytes(PathConstants.BcTestFilesFolder + "test.bgra32");
18+
originalBgra32LogoData = File.ReadAllBytes(TestFileFolders.BcTestFiles + "test.bgra32");
1919
}
2020

2121
[Test]
2222
public void DecompressDXT1Test()
2323
{
24-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt1");
24+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt1");
2525
int totalBytesRead = 0;
2626
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4 }) //mipmaps 2 and 1 cause a buffer overrun for the output
2727
{
@@ -36,7 +36,7 @@ public void DecompressDXT1Test()
3636
[Test]
3737
public void DecompressDXT3Test()
3838
{
39-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt3");
39+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt3");
4040
int totalBytesRead = 0;
4141
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4 }) //mipmaps 2 and 1 cause a buffer overrun for the output
4242
{
@@ -51,7 +51,7 @@ public void DecompressDXT3Test()
5151
[Test]
5252
public void DecompressDXT5Test()
5353
{
54-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt5");
54+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt5");
5555
int totalBytesRead = 0;
5656
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4 }) //mipmaps 2 and 1 cause a buffer overrun for the output
5757
{
@@ -66,53 +66,53 @@ public void DecompressDXT5Test()
6666
[Test]
6767
public void DecompressBC4Test()
6868
{
69-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.BcTestFilesFolder + "test.bc4");
69+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.BcTestFiles + "test.bc4");
7070
int bytesRead = Bc4.Decompress(data, 512, 512, out _);
7171
Assert.That(bytesRead, Is.EqualTo(data.Length));
7272
}
7373

7474
[Test]
7575
public void DecompressBC5Test()
7676
{
77-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.BcTestFilesFolder + "test.bc5");
77+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.BcTestFiles + "test.bc5");
7878
int bytesRead = Bc5.Decompress(data, 512, 512, out _);
7979
Assert.That(bytesRead, Is.EqualTo(data.Length));
8080
}
8181

8282
[Test]
8383
public void DecompressBC6HFastTest()
8484
{
85-
AssertCorrectBC6HDecompression(PathConstants.BcTestFilesFolder + "test.bc6h_fast", 512, 512, false);
85+
AssertCorrectBC6HDecompression(TestFileFolders.BcTestFiles + "test.bc6h_fast", 512, 512, false);
8686
}
8787

8888
[Test]
8989
public void DecompressBC6HNormalTest()
9090
{
91-
AssertCorrectBC6HDecompression(PathConstants.BcTestFilesFolder + "test.bc6h_normal", 512, 512, false);
91+
AssertCorrectBC6HDecompression(TestFileFolders.BcTestFiles + "test.bc6h_normal", 512, 512, false);
9292
}
9393

9494
[Test]
9595
public void DecompressBC6HBestTest()
9696
{
97-
AssertCorrectBC6HDecompression(PathConstants.BcTestFilesFolder + "test.bc6h_best", 512, 512, false);
97+
AssertCorrectBC6HDecompression(TestFileFolders.BcTestFiles + "test.bc6h_best", 512, 512, false);
9898
}
9999

100100
[Test]
101101
public void DecompressBC7FastTest()
102102
{
103-
AssertCorrectBC7Decompression(PathConstants.BcTestFilesFolder + "test.bc7_fast", 512, 512);
103+
AssertCorrectBC7Decompression(TestFileFolders.BcTestFiles + "test.bc7_fast", 512, 512);
104104
}
105105

106106
[Test]
107107
public void DecompressBC7NormalTest()
108108
{
109-
AssertCorrectBC7Decompression(PathConstants.BcTestFilesFolder + "test.bc7_normal", 512, 512);
109+
AssertCorrectBC7Decompression(TestFileFolders.BcTestFiles + "test.bc7_normal", 512, 512);
110110
}
111111

112112
[Test]
113113
public void DecompressBC7BestTest()
114114
{
115-
AssertCorrectBC7Decompression(PathConstants.BcTestFilesFolder + "test.bc7_best", 512, 512);
115+
AssertCorrectBC7Decompression(TestFileFolders.BcTestFiles + "test.bc7_best", 512, 512);
116116
}
117117

118118
private static void AssertCorrectBC6HDecompression(string path, int width, int height, bool isSigned)
@@ -186,4 +186,4 @@ private static void AssertMinimalDeviation(byte[] decoded, byte[] original, doub
186186
});
187187
}
188188
}
189-
}
189+
}

AssetRipper.TextureDecoder.Tests/DxtTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public sealed class DxtTests
55
[Test]
66
public void DecompressDXT1Test()
77
{
8-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt1");
8+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt1");
99
int totalBytesRead = 0;
1010
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
1111
{
@@ -18,7 +18,7 @@ public void DecompressDXT1Test()
1818
[Test]
1919
public void DecompressDXT3Test()
2020
{
21-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt3");
21+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt3");
2222
int totalBytesRead = 0;
2323
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
2424
{
@@ -31,7 +31,7 @@ public void DecompressDXT3Test()
3131
[Test]
3232
public void DecompressDXT5Test()
3333
{
34-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.DxtTestFilesFolder + "test.dxt5");
34+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.DxtTestFiles + "test.dxt5");
3535
int totalBytesRead = 0;
3636
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
3737
{
@@ -41,4 +41,4 @@ public void DecompressDXT5Test()
4141
Assert.That(totalBytesRead, Is.EqualTo(data.Length));
4242
}
4343
}
44-
}
44+
}

AssetRipper.TextureDecoder.Tests/EtcTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public sealed class EtcTests
55
[Test]
66
public void DecompressETCTest()
77
{
8-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.etc");
8+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.etc");
99
int totalBytesRead = 0;
1010
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
1111
{
@@ -18,7 +18,7 @@ public void DecompressETCTest()
1818
[Test]
1919
public void DecompressETC2Test()
2020
{
21-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.etc2");
21+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.etc2");
2222
int totalBytesRead = 0;
2323
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
2424
{
@@ -31,7 +31,7 @@ public void DecompressETC2Test()
3131
[Test]
3232
public void DecompressETC2A1Test()
3333
{
34-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.etc2a1");
34+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.etc2a1");
3535
int totalBytesRead = 0;
3636
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
3737
{
@@ -44,7 +44,7 @@ public void DecompressETC2A1Test()
4444
[Test]
4545
public void DecompressETC2A8Test()
4646
{
47-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.etc2a8");
47+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.etc2a8");
4848
int totalBytesRead = 0;
4949
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
5050
{
@@ -57,7 +57,7 @@ public void DecompressETC2A8Test()
5757
[Test]
5858
public void DecompressEACRSignedTest()
5959
{
60-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.eac_r");
60+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.eac_r");
6161
int totalBytesRead = 0;
6262
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
6363
{
@@ -70,7 +70,7 @@ public void DecompressEACRSignedTest()
7070
[Test]
7171
public void DecompressEACRUnsignedTest()
7272
{
73-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.eac_r");
73+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.eac_r");
7474
int totalBytesRead = 0;
7575
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
7676
{
@@ -83,7 +83,7 @@ public void DecompressEACRUnsignedTest()
8383
[Test]
8484
public void DecompressEACRGSignedTest()
8585
{
86-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.eac_rg");
86+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.eac_rg");
8787
int totalBytesRead = 0;
8888
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
8989
{
@@ -96,7 +96,7 @@ public void DecompressEACRGSignedTest()
9696
[Test]
9797
public void DecompressEACRGUnsignedTest()
9898
{
99-
ReadOnlySpan<byte> data = File.ReadAllBytes(PathConstants.EtcTestFilesFolder + "test.eac_rg");
99+
ReadOnlySpan<byte> data = File.ReadAllBytes(TestFileFolders.EtcTestFiles + "test.eac_rg");
100100
int totalBytesRead = 0;
101101
foreach (int size in new int[] { 256, 128, 64, 32, 16, 8, 4, 2, 1 }) //mip maps
102102
{
@@ -106,4 +106,4 @@ public void DecompressEACRGUnsignedTest()
106106
Assert.That(totalBytesRead, Is.EqualTo(data.Length));
107107
}
108108
}
109-
}
109+
}

0 commit comments

Comments
 (0)