More tests
This commit is contained in:
Родитель
b8af8906cf
Коммит
ef317db4af
|
@ -34,5 +34,23 @@ namespace SkiaSharp.Tests
|
|||
Assert.NotNull(grContext);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GpuSurfaceIsCreated()
|
||||
{
|
||||
using (var ctx = CreateGlContext()) {
|
||||
ctx.MakeCurrent();
|
||||
|
||||
using (var grContext = GRContext.Create(GRBackend.OpenGL))
|
||||
using (var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100))) {
|
||||
Assert.NotNull(surface);
|
||||
|
||||
var canvas = surface.Canvas;
|
||||
Assert.NotNull(canvas);
|
||||
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
[Parallelizable(ParallelScope.None)]
|
||||
public class SKCanvasTest : SKTest
|
||||
{
|
||||
[Test]
|
||||
public void CanvasCanRestoreOnGpu()
|
||||
{
|
||||
using (var ctx = CreateGlContext()) {
|
||||
ctx.MakeCurrent();
|
||||
|
||||
using (var grContext = GRContext.Create(GRBackend.OpenGL))
|
||||
using (var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100))) {
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
Assert.AreEqual(SKMatrix.MakeIdentity(), canvas.TotalMatrix);
|
||||
|
||||
using (new SKAutoCanvasRestore(canvas)) {
|
||||
canvas.Translate(10, 10);
|
||||
Assert.AreEqual(SKMatrix.MakeTranslation(10, 10), canvas.TotalMatrix);
|
||||
}
|
||||
|
||||
Assert.AreEqual(SKMatrix.MakeIdentity(), canvas.TotalMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче