Skip to content

Commit c9de72c

Browse files
Add GRContext Metal backend test
1 parent 60e8175 commit c9de72c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/SkiaSharp.Tests.Devices/Tests/iOS/iOSExtensionsTests.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using CoreGraphics;
1+
using System;
2+
using CoreGraphics;
23
using Foundation;
4+
using Metal;
35
using Xunit;
46

57
namespace SkiaSharp.Views.iOS.Tests
@@ -99,5 +101,21 @@ public void CGRectToSKRect(int x, int y, int w, int h)
99101

100102
Assert.Equal(expected, actual);
101103
}
104+
105+
[SkippableFact]
106+
public void GRContextDisposeDoesNotCrash()
107+
{
108+
var device = MTLDevice.SystemDefault!;
109+
Skip.If(device == null, "Metal is not supported on this device.");
110+
111+
using var commandQueue = device.CreateCommandQueue();
112+
using var backendContext = new GRMtlBackendContext()
113+
{
114+
Device = device,
115+
Queue = commandQueue,
116+
};
117+
118+
using var context = GRContext.CreateMetal(backendContext);
119+
}
102120
}
103121
}

0 commit comments

Comments
 (0)