diff --git a/tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.csproj b/tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.csproj index 86f88c15..506202e8 100644 --- a/tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.csproj +++ b/tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.csproj @@ -1,16 +1,13 @@ - - - + + Debug AnyCPU {F0179CDB-9435-4FB4-8E52-DBF191079491} Library - Properties SkiaSharp.Tests SkiaSharp.Tests - v4.5 - 512 + v4.6.1 True @@ -74,14 +71,8 @@ - - - - - - diff --git a/tests/Tests/SKShaperTest.cs b/tests/Tests/SKShaperTest.cs index 6b57484a..c1a12815 100644 --- a/tests/Tests/SKShaperTest.cs +++ b/tests/Tests/SKShaperTest.cs @@ -6,10 +6,11 @@ using Xunit; using SkiaSharp; using SkiaSharp.HarfBuzz; +using SkiaSharp.Tests; namespace HarfBuzzSharp.Tests { - public class SKShaperTest : TestBase + public class SKShaperTest : SKTest { [SkippableFact] public void DrawShapedTextExtensionMethodDraws() @@ -72,56 +73,4 @@ namespace HarfBuzzSharp.Tests } } } - - public abstract class TestBase - { - protected static readonly string PathToAssembly = Path.GetDirectoryName(typeof(TestBase).GetTypeInfo().Assembly.Location); - protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts"); - protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images"); - -#if NET_STANDARD - protected static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - protected static bool IsMac => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - protected static bool IsUnix => IsLinux || IsMac; - protected static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); -#else - private static class MacPlatformDetector - { - internal static readonly Lazy IsMac = new Lazy(IsRunningOnMac); - - [DllImport("libc")] - static extern int uname(IntPtr buf); - - static bool IsRunningOnMac() - { - IntPtr buf = IntPtr.Zero; - try - { - buf = Marshal.AllocHGlobal(8192); - // This is a hacktastic way of getting sysname from uname () - if (uname(buf) == 0) - { - string os = Marshal.PtrToStringAnsi(buf); - if (os == "Darwin") - return true; - } - } - catch - { - } - finally - { - if (buf != IntPtr.Zero) - Marshal.FreeHGlobal(buf); - } - return false; - } - } - - protected static bool IsMac => MacPlatformDetector.IsMac.Value; - protected static bool IsUnix => Environment.OSVersion.Platform == PlatformID.Unix || IsMac; - protected static bool IsLinux => IsUnix && !IsMac; - protected static bool IsWindows => !IsUnix; -#endif - } } \ No newline at end of file diff --git a/tests/Tests/SKTest.cs b/tests/Tests/SKTest.cs index bfdb81af..f656c729 100644 --- a/tests/Tests/SKTest.cs +++ b/tests/Tests/SKTest.cs @@ -9,7 +9,7 @@ namespace SkiaSharp.Tests { public abstract class SKTest { - protected static readonly string PathToAssembly = Path.GetDirectoryName(typeof(SKTest).GetTypeInfo().Assembly.Location); + protected static readonly string PathToAssembly = Directory.GetCurrentDirectory(); protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts"); protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images");