Browse Source

Fix mocks

pull/8313/head
Benedikt Stebner 4 years ago
parent
commit
020c8de59e
  1. 7
      src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs
  2. 5
      tests/Avalonia.Base.UnitTests/VisualTree/MockRenderInterface.cs
  3. 5
      tests/Avalonia.Benchmarks/NullRenderingPlatform.cs
  4. 7
      tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs

7
src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs

@ -114,6 +114,13 @@ namespace Avalonia.Headless
return new HeadlessGlyphRunStub(); return new HeadlessGlyphRunStub();
} }
public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun, out Matrix scale)
{
scale = Matrix.Identity;
return new HeadlessGeometryStub(new Rect(glyphRun.Size));
}
class HeadlessGeometryStub : IGeometryImpl class HeadlessGeometryStub : IGeometryImpl
{ {
public HeadlessGeometryStub(Rect bounds) public HeadlessGeometryStub(Rect bounds)

5
tests/Avalonia.Base.UnitTests/VisualTree/MockRenderInterface.cs

@ -121,6 +121,11 @@ namespace Avalonia.Base.UnitTests.VisualTree
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun, out Matrix scale)
{
throw new NotImplementedException();
}
class MockStreamGeometry : IStreamGeometryImpl class MockStreamGeometry : IStreamGeometryImpl
{ {
private MockStreamGeometryContext _impl = new MockStreamGeometryContext(); private MockStreamGeometryContext _impl = new MockStreamGeometryContext();

5
tests/Avalonia.Benchmarks/NullRenderingPlatform.cs

@ -117,6 +117,11 @@ namespace Avalonia.Benchmarks
return new NullGlyphRun(); return new NullGlyphRun();
} }
public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun, out Matrix scale)
{
throw new NotImplementedException();
}
public bool SupportsIndividualRoundRects => true; public bool SupportsIndividualRoundRects => true;
public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul; public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul;

7
tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs

@ -122,6 +122,13 @@ namespace Avalonia.UnitTests
return Mock.Of<IGlyphRunImpl>(); return Mock.Of<IGlyphRunImpl>();
} }
public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun, out Matrix scale)
{
scale = Matrix.Identity;
return Mock.Of<IGeometryImpl>();
}
public bool SupportsIndividualRoundRects { get; set; } public bool SupportsIndividualRoundRects { get; set; }
public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul; public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul;

Loading…
Cancel
Save