Browse Source

Skip tests if hw acceleration not present

Krzysztof Krysiński 3 months ago
parent
commit
ce70d9b02b

+ 14 - 7
tests/PixiEditor.Tests/PixiEditorTest.cs

@@ -27,13 +27,20 @@ public class PixiEditorTest
             return;
         }
 
-        var engine = DesktopDrawingEngine.CreateDefaultDesktop();
-        var app = new TestingApp();
-        app.Initialize(engine);
-        IWindow window = app.CreateMainWindow();
-        window.IsVisible = false;
-        window.Initialize();
-        DrawingBackendApi.InitializeBackend(engine.RenderApi);
+        try
+        {
+            var engine = DesktopDrawingEngine.CreateDefaultDesktop();
+            var app = new TestingApp();
+            app.Initialize(engine);
+            IWindow window = app.CreateMainWindow();
+            window.IsVisible = false;
+            window.Initialize();
+            DrawingBackendApi.InitializeBackend(engine.RenderApi);
+        }
+        catch (Exception ex)
+        {
+            DrawingBackendApi.SetupBackend(new SkiaDrawingBackend(), new DrawieRenderingDispatcher());
+        }
     }
 }
 

+ 15 - 0
tests/PixiEditor.Tests/RenderTests.cs

@@ -1,11 +1,20 @@
 using Avalonia.Headless.XUnit;
 using Drawie.Backend.Core;
+using Drawie.Backend.Core.Bridge;
 using PixiEditor.Models.IO;
+using Xunit.Abstractions;
 
 namespace PixiEditor.Tests;
 
 public class RenderTests : FullPixiEditorTest
 {
+    private readonly ITestOutputHelper _testOutputHelper;
+
+    public RenderTests(ITestOutputHelper testOutputHelper)
+    {
+        _testOutputHelper = testOutputHelper;
+    }
+
     [AvaloniaTheory]
     [InlineData("Fibi")]
     [InlineData("Pond")]
@@ -15,6 +24,12 @@ public class RenderTests : FullPixiEditorTest
     [InlineData("SmlPxlCircShadWithMaskClippedInFolder")]
     public void TestThatPixiFilesRenderTheSameResultAsSavedPng(string fileName)
     {
+        if (!DrawingBackendApi.Current.IsHardwareAccelerated)
+        {
+            _testOutputHelper.WriteLine("Skipping the test because hardware acceleration is not enabled.");
+            return;
+        }
+
         string pixiFile = Path.Combine("TestFiles", "RenderTests", fileName + ".pixi");
         string pngFile = Path.Combine("TestFiles", "RenderTests", fileName + ".png");
         var document = Importer.ImportDocument(pixiFile);

BIN
tests/TestDrivers/Windows/vk_swiftshader.zip


+ 0 - 7
tests/TestDrivers/Windows/vk_swiftshader_icd.json

@@ -1,7 +0,0 @@
-{
-  "file_format_version": "1.0.0",
-  "ICD": {
-    "library_path": ".\\vk_swiftshader.dll",
-    "api_version": "1.0.5"
-  }
-}

BIN
tests/TestDrivers/Windows/vulkan-1.zip