Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NesTiler.git/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <cluster@cluster.wtf>2023-09-19 22:33:12 +0300
committerAlexey 'Cluster' Avdyukhin <cluster@cluster.wtf>2023-09-19 22:33:12 +0300
commit4cd7bfff61129f2189b391364f0ee0b1374c5261 (patch)
tree5f8333724f85963cc285b0f202da043e9e609762
parent2637455503f9ca24ce0597a19db374c349169894 (diff)
New test.
-rw-r--r--TestImages/TestImages.csproj3
-rw-r--r--Tests/Program.cs48
-rw-r--r--Tests/Tests.csproj12
3 files changed, 56 insertions, 7 deletions
diff --git a/TestImages/TestImages.csproj b/TestImages/TestImages.csproj
index 35300fb..842661e 100644
--- a/TestImages/TestImages.csproj
+++ b/TestImages/TestImages.csproj
@@ -13,6 +13,9 @@
</ItemGroup>
<ItemGroup>
+ <None Update="Images\ascii.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<None Update="Images\belaya_akula.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
diff --git a/Tests/Program.cs b/Tests/Program.cs
index de69144..2ef47ea 100644
--- a/Tests/Program.cs
+++ b/Tests/Program.cs
@@ -150,6 +150,13 @@ namespace com.clusterrr.Famicom.NesTiler.Tests
}
[Test]
+ public void AsciiNoGroup()
+ {
+ var imagePath = Path.Combine(ImagesPath, "ascii.png");
+ DoTestAsciiNoGroup(imagePath);
+ }
+
+ [Test]
public void MeLossy()
{
var imagePath = Path.Combine(ImagesPath, "me.png");
@@ -170,13 +177,13 @@ namespace com.clusterrr.Famicom.NesTiler.Tests
DoTestSprites8x16(imagePath);
}
- private string PatternTablePath(string prefix, int number) => $"{prefix}_pattern_{number}.bin";
- private string NameTablePath(string prefix, int number) => $"{prefix}_name_table_{number}.bin";
- private string AttrTablePath(string prefix, int number) => $"{prefix}_attr_table_{number}.bin";
- private string PalettePath(string prefix, int number) => $"{prefix}_palette_{number}.bin";
- private string TilesCsvPath(string prefix) => $"{prefix}_tiles.csv";
- private string PalettesCsvPath(string prefix) => $"{prefix}_palettes.csv";
- private string SpritesCsvPath(string prefix) => $"{prefix}_sprites.csv";
+ private string PatternTablePath(string prefix, int number) => $"E:\\tiles\\{prefix}_pattern_{number}.bin";
+ private string NameTablePath(string prefix, int number) => $"E:\\tiles\\{prefix}_name_table_{number}.bin";
+ private string AttrTablePath(string prefix, int number) => $"E:\\tiles\\{prefix}_attr_table_{number}.bin";
+ private string PalettePath(string prefix, int number) => $"E:\\tiles\\{prefix}_palette_{number}.bin";
+ private string TilesCsvPath(string prefix) => $"E:\\tiles\\{prefix}_tiles.csv";
+ private string PalettesCsvPath(string prefix) => $"E:\\tiles\\{prefix}_palettes.csv";
+ private string SpritesCsvPath(string prefix) => $"E:\\tiles\\{prefix}_sprites.csv";
public void DoTestNoSplit(string imagePath)
{
@@ -254,6 +261,33 @@ namespace com.clusterrr.Famicom.NesTiler.Tests
Assert.That(File.ReadAllLines(PalettesCsvPath(prefix)).Select(l => l.Replace('/', '\\')), Is.EqualTo(File.ReadAllLines(Path.Combine(ReferencesDir, PalettesCsvPath(prefix))).Select(l => l.Replace('/', '\\'))), "palette CSV");
}
+ public void DoTestAsciiNoGroup(string imagePath)
+ {
+ var prefix = Path.GetFileNameWithoutExtension(imagePath);
+ var args = new string[] {
+ "--enable-palettes", "0",
+ "--in-0", $"{imagePath}",
+ "--out-pattern-table-0", PatternTablePath(prefix, 0),
+ "--out-palette-0", PalettePath(prefix, 0),
+ "--out-tiles-csv", TilesCsvPath(prefix),
+ "--out-palettes-csv", PalettesCsvPath(prefix),
+ "--no-group-tiles-0",
+ "--quiet",
+ };
+ var r = Program.Main(args);
+ if (r != 0) throw new InvalidOperationException($"Return code: {r}");
+
+ Assert.That(File.ReadAllBytes(PatternTablePath(prefix, 0)), Is.EqualTo(File.ReadAllBytes(Path.Combine(ReferencesDir, PatternTablePath(prefix, 0)))), "pattern table");
+ Assert.That(File.ReadAllBytes(PalettePath(prefix, 0)), Is.EqualTo(File.ReadAllBytes(Path.Combine(ReferencesDir, PalettePath(prefix, 0)))), "palette 0");
+ Assert.That(File.ReadAllLines(TilesCsvPath(prefix)).Select(l => l.Replace('/', '\\')), Is.EqualTo(File.ReadAllLines(Path.Combine(ReferencesDir, TilesCsvPath(prefix))).Select(l => l.Replace('/', '\\'))), "tiles CSV");
+ Assert.That(File.ReadAllLines(PalettesCsvPath(prefix)).Select(l => l.Replace('/', '\\')), Is.EqualTo(File.ReadAllLines(Path.Combine(ReferencesDir, PalettesCsvPath(prefix))).Select(l => l.Replace('/', '\\'))), "palette CSV");
+
+ Assert.That(File.ReadAllBytes(PatternTablePath(prefix, 0)), Is.EqualTo(File.ReadAllBytes(Path.Combine(ReferencesDir, PatternTablePath(prefix, 0)))), "pattern table");
+ Assert.That(File.ReadAllBytes(PalettePath(prefix, 0)), Is.EqualTo(File.ReadAllBytes(Path.Combine(ReferencesDir, PalettePath(prefix, 0)))), "palette 0");
+ Assert.That(File.ReadAllLines(TilesCsvPath(prefix)).Select(l => l.Replace('/', '\\')), Is.EqualTo(File.ReadAllLines(Path.Combine(ReferencesDir, TilesCsvPath(prefix))).Select(l => l.Replace('/', '\\'))), "tiles CSV");
+ Assert.That(File.ReadAllLines(PalettesCsvPath(prefix)).Select(l => l.Replace('/', '\\')), Is.EqualTo(File.ReadAllLines(Path.Combine(ReferencesDir, PalettesCsvPath(prefix))).Select(l => l.Replace('/', '\\'))), "palette CSV");
+ }
+
public void DoTestSplit2(string imagePath)
{
var prefix = Path.GetFileNameWithoutExtension(imagePath);
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 782a9e3..44e2c61 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -21,6 +21,18 @@
</ItemGroup>
<ItemGroup>
+ <None Update="References\ascii_palettes.csv">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Update="References\ascii_palette_0.bin">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Update="References\ascii_pattern_0.bin">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Update="References\ascii_tiles.csv">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<None Update="References\belaya_akula_attr_table_0.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>