Fix Mac project, fix Android icon test

mac
Miepee 4 years ago
parent b8087c8ed2
commit ff3790f385

@ -2,9 +2,10 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0-macos</TargetFramework>
<RollForward>LatestMajor</RollForward> <RollForward>LatestMajor</RollForward>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
<SupportedOSPlatformVersion>10.14</SupportedOSPlatformVersion>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers> <RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
@ -14,7 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Eto.Platform.Mac64" Version="2.7.0" /> <PackageReference Include="Eto.Platform.macOS" Version="2.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<!--TODO: UndertaleModLib needs to properly support .net standard! --> <!--UndertaleModLib needs to properly support .net standard! -->
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
@ -43,4 +43,4 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -407,7 +407,8 @@ public abstract class RawMods : ModsBase
pStartInfo = new ProcessStartInfo pStartInfo = new ProcessStartInfo
{ {
FileName = bin, FileName = bin,
Arguments = args + "\"" + apktool + "\" b \"" + apkDir + "\" -o \"" + extractDirectory + "/build.apk" + "\"", // Use aapt2 and nc are to ensure that aapt doesn't preprocess images before using then. Needed for tests.
Arguments = args + "\"" + apktool + "\" b \"" + apkDir + "\" -o \"" + extractDirectory + "/build.apk" + "\" --use-aapt2 -nc ",
CreateNoWindow = true CreateNoWindow = true
}; };
p = new Process { StartInfo = pStartInfo }; p = new Process { StartInfo = pStartInfo };

@ -11,6 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

@ -1,5 +1,7 @@
using System.IO.Compression; using System.IO.Compression;
using GlennLib; using GlennLib;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using UndertaleModLib; using UndertaleModLib;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
@ -705,8 +707,7 @@ public class RawModsTests : IDisposable
CheckIconsWithPath(inputZip); CheckIconsWithPath(inputZip);
} }
// TODO: see skip reason [Theory]
[Theory(Skip = "Currently buggy, due to probably an apktool bug.")]
[InlineData("./GameWin.zip")] [InlineData("./GameWin.zip")]
[InlineData("./GameLin.zip")] [InlineData("./GameLin.zip")]
[InlineData("./GameMac.zip")] [InlineData("./GameMac.zip")]
@ -727,6 +728,7 @@ public class RawModsTests : IDisposable
var outputZip = testTempDir + Guid.NewGuid(); var outputZip = testTempDir + Guid.NewGuid();
var newExtract = testTempDir + Guid.NewGuid() + "/"; var newExtract = testTempDir + Guid.NewGuid() + "/";
var recoloredIcon = testTempDir + Guid.NewGuid();
// With default icons // With default icons
void CheckIconsWithPath(string? path) void CheckIconsWithPath(string? path)
@ -754,7 +756,13 @@ public class RawModsTests : IDisposable
} }
CheckIconsWithPath(null); CheckIconsWithPath(null);
CheckIconsWithPath(inputZip); var imagePath = RawMods.GetProperPathToBuiltinIcons(nameof(Resources.icon), null);
using (Image img = Image.Load(imagePath))
{
img.Mutate(c => c.Hue(180));
img.SaveAsPng(recoloredIcon);
}
CheckIconsWithPath(recoloredIcon);
} }
#endregion #endregion

Loading…
Cancel
Save