MockPlatformRenderInterface.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 IFormattedTextImpl CreateFormattedText(
  12. string text,
  13. Typeface typeface,
  14. TextAlignment textAlignment,
  15. TextWrapping wrapping,
  16. Size constraint,
  17. IReadOnlyList<FormattedTextStyleSpan> spans)
  18. {
  19. return Mock.Of<IFormattedTextImpl>();
  20. }
  21. public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
  22. {
  23. return Mock.Of<IRenderTarget>();
  24. }
  25. public IRenderTargetBitmapImpl CreateRenderTargetBitmap(
  26. int width,
  27. int height,
  28. double dpiX,
  29. double dpiY)
  30. {
  31. return Mock.Of<IRenderTargetBitmapImpl>();
  32. }
  33. public IStreamGeometryImpl CreateStreamGeometry()
  34. {
  35. return new MockStreamGeometryImpl();
  36. }
  37. public IWritableBitmapImpl CreateWritableBitmap(int width, int height, 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(PixelFormat format, IntPtr data, int width, int height, int stride)
  50. {
  51. throw new NotImplementedException();
  52. }
  53. }
  54. }