MockPlatformRenderInterface.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Avalonia.Media;
  5. using Avalonia.Platform;
  6. using Moq;
  7. namespace Avalonia.UnitTests
  8. {
  9. public class MockPlatformRenderInterface : IPlatformRenderInterface
  10. {
  11. public IEnumerable<string> InstalledFontNames => Mock.Of<IEnumerable<string>>();
  12. public IFormattedTextImpl CreateFormattedText(
  13. string text,
  14. Typeface typeface,
  15. TextAlignment textAlignment,
  16. TextWrapping wrapping,
  17. Size constraint,
  18. IReadOnlyList<FormattedTextStyleSpan> spans)
  19. {
  20. return Mock.Of<IFormattedTextImpl>();
  21. }
  22. public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
  23. {
  24. return Mock.Of<IRenderTarget>();
  25. }
  26. public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi)
  27. {
  28. return Mock.Of<IRenderTargetBitmapImpl>();
  29. }
  30. public IStreamGeometryImpl CreateStreamGeometry()
  31. {
  32. return new MockStreamGeometryImpl();
  33. }
  34. public IWriteableBitmapImpl CreateWriteableBitmap(
  35. PixelSize size,
  36. Vector dpi,
  37. PixelFormat? format = default(PixelFormat?))
  38. {
  39. throw new NotImplementedException();
  40. }
  41. public IBitmapImpl LoadBitmap(Stream stream)
  42. {
  43. return Mock.Of<IBitmapImpl>();
  44. }
  45. public IBitmapImpl LoadBitmap(string fileName)
  46. {
  47. return Mock.Of<IBitmapImpl>();
  48. }
  49. public IBitmapImpl LoadBitmap(
  50. PixelFormat format,
  51. IntPtr data,
  52. PixelSize size,
  53. Vector dpi,
  54. int stride)
  55. {
  56. throw new NotImplementedException();
  57. }
  58. }
  59. }