diff --git a/build.cake b/build.cake index b3822271d4..5fd6859dda 100644 --- a/build.cake +++ b/build.cake @@ -157,10 +157,13 @@ Task("Build") } }); -void RunCoreTest(string dir, Parameters parameters, bool net461Only) + +void RunCoreTest(string project, Parameters parameters, bool net461Only) { - Information("Running tests from " + dir); - DotNetCoreRestore(dir); + if(!project.EndsWith(".csproj")) + project = System.IO.Path.Combine(project, System.IO.Path.GetFileName(project)+".csproj"); + Information("Running tests from " + project); + DotNetCoreRestore(project); var frameworks = new List(){"netcoreapp1.1"}; if(parameters.IsRunningOnWindows) frameworks.Add("net461"); @@ -169,7 +172,8 @@ void RunCoreTest(string dir, Parameters parameters, bool net461Only) if(fw != "net461" && net461Only) continue; Information("Running for " + fw); - DotNetCoreTest(System.IO.Path.Combine(dir, System.IO.Path.GetFileName(dir)+".csproj"), + + DotNetCoreTest(project, new DotNetCoreTestSettings { Configuration = parameters.Configuration, Framework = fw @@ -189,6 +193,8 @@ Task("Run-Net-Core-Unit-Tests") RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Styling.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, false); + if(parameters.IsRunningOnWindows) + RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, false); }); Task("Run-Unit-Tests") diff --git a/build/Magick.NET-Q16-AnyCPU.props b/build/Magick.NET-Q16-AnyCPU.props index ec747a17d8..4e600a1c11 100644 --- a/build/Magick.NET-Q16-AnyCPU.props +++ b/build/Magick.NET-Q16-AnyCPU.props @@ -1,5 +1,5 @@ - + diff --git a/src/Skia/Avalonia.Skia/BitmapImpl.cs b/src/Skia/Avalonia.Skia/BitmapImpl.cs index e5e8faec5f..af6bd5b42f 100644 --- a/src/Skia/Avalonia.Skia/BitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/BitmapImpl.cs @@ -38,29 +38,6 @@ namespace Avalonia.Skia Bitmap.Dispose(); } - public void Save(string fileName) - { - -#if DESKTOP - if(Bitmap.ColorType != SKColorType.Bgra8888) - { - using (var tmp = new BitmapImpl(Bitmap.Copy(SKColorType.Bgra8888))) - tmp.Save(fileName); - return; - } - - IntPtr length; - using (var sdb = new System.Drawing.Bitmap(PixelWidth, PixelHeight, Bitmap.RowBytes, - - System.Drawing.Imaging.PixelFormat.Format32bppArgb, - - Bitmap.GetPixels(out length))) - sdb.Save(fileName); -#else - //SkiaSharp doesn't expose image encoders yet -#endif - } - public int PixelWidth { get; private set; } public int PixelHeight { get; private set; } @@ -111,6 +88,12 @@ namespace Avalonia.Skia } } + public void Save(string fileName) + { + using (var stream = File.Create(fileName)) + Save(stream); + } + class BitmapFramebuffer : ILockedFramebuffer { private SKBitmap _bmp; diff --git a/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj b/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj index 0627d5e945..e22c0920b3 100644 --- a/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj +++ b/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj @@ -1,107 +1,37 @@ - - - + - Debug - AnyCPU - {D35A9F3D-8BB0-496E-BF72-444038A7DEBB} + netcoreapp1.1;net461 + x86 + bin\$(Configuration) + false + False + $(DefineConstants);AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL Library - Properties - Avalonia.Skia.RenderTests - Avalonia.Skia.RenderTests - v4.6.1 - 512 - - - true - full - false - ..\..\artifacts\tests\ - TRACE;DEBUG;AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL - prompt - 4 - - - pdbonly - true - ..\..\artifacts\tests\ - TRACE;AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL - prompt - 4 - - - true - ..\..\artifacts\tests\ - TRACE;DEBUG;AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL - full - x86 - - - ..\..\artifacts\tests\ - TRACE;AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL; - true - x86 - - - - - - - - - - - - - - - - - {d211e587-d8bc-45b9-95a4-f297c8fa5200} - Avalonia.Animation - - - {b09b78d8-9b26-48b0-9149-d64a2f120f3f} - Avalonia.Base - - - {d2221c82-4a25-4583-9b43-d791e3f6820c} - Avalonia.Controls - - - {62024b2d-53eb-4638-b26b-85eeaa54866e} - Avalonia.Input - - - {6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b} - Avalonia.Interactivity - - - {42472427-4774-4c81-8aff-9f27b8e31721} - Avalonia.Layout - - - {eb582467-6abb-43a1-b052-e981ba910e3a} - Avalonia.Visuals - - - {f1baa01a-f176-4c6a-b39d-5b40bb1b148f} - Avalonia.Styling - - - {7d2d3083-71dd-4cc9-8907-39a0d86fb322} - Avalonia.Skia - - - - + + + + + + + + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index 385cb052da..146305dc75 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -44,7 +44,7 @@ namespace Avalonia.Direct2D1.RenderTests #if AVALONIA_CAIRO string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Cairo"); #elif AVALONIA_SKIA - string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Skia"); + string testFiles = Path.GetFullPath(@"..\..\..\..\TestFiles\Skia"); #else string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Direct2D1"); #endif @@ -63,7 +63,8 @@ namespace Avalonia.Direct2D1.RenderTests Directory.CreateDirectory(OutputPath); } - string path = Path.Combine(OutputPath, testName + ".out.png"); + string path = Path.GetFullPath(Path.Combine(OutputPath, testName + ".out.png")); + System.Console.WriteLine("Rendering to "+path); using (RenderTargetBitmap bitmap = new RenderTargetBitmap( (int)target.Width, diff --git a/tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png b/tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png index 935ba57aff..0baec42e6e 100644 Binary files a/tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png and b/tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png differ