MockCanvas.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using QuestPDF.Infrastructure;
  3. using QuestPDF.Skia;
  4. using QuestPDF.Skia.Text;
  5. using SkiaSharp;
  6. namespace QuestPDF.UnitTests.TestEngine
  7. {
  8. internal sealed class MockCanvas : ICanvas
  9. {
  10. public Action<Position> TranslateFunc { get; set; }
  11. public Action<float> RotateFunc { get; set; }
  12. public Action<float, float> ScaleFunc { get; set; }
  13. public Action<SkImage, Position, Size> DrawImageFunc { get; set; }
  14. public Action<Position, Size, Color> DrawRectFunc { get; set; }
  15. public void Save() => throw new NotImplementedException();
  16. public void Restore() => throw new NotImplementedException();
  17. public CanvasMatrix GetCurrentMatrix() => throw new NotImplementedException();
  18. public void Translate(Position vector) => TranslateFunc(vector);
  19. public void Rotate(float angle) => RotateFunc(angle);
  20. public void Scale(float scaleX, float scaleY) => ScaleFunc(scaleX, scaleY);
  21. public void DrawFilledRectangle(Position vector, Size size, Color color) => DrawRectFunc(vector, size, color);
  22. public void DrawStrokeRectangle(Position vector, Size size, float strokeWidth, Color color) => throw new NotImplementedException();
  23. public void DrawParagraph(SkParagraph paragraph) => throw new NotImplementedException();
  24. public void DrawImage(SkImage image, Size size) => DrawImageFunc(image, Position.Zero, size);
  25. public void DrawPicture(SkPicture picture) => throw new NotImplementedException();
  26. public void DrawSvgPath(string path, Color color) => throw new NotImplementedException();
  27. public void DrawSvg(SkSvgImage svgImage, Size size) => throw new NotImplementedException();
  28. public void DrawOverflowArea(SkRect area) => throw new NotImplementedException();
  29. public void ClipOverflowArea(SkRect availableSpace, SkRect requiredSpace) => throw new NotImplementedException();
  30. public void ClipRectangle(SkRect clipArea) => throw new NotImplementedException();
  31. public void DrawHyperlink(string url, Size size) => throw new NotImplementedException();
  32. public void DrawSectionLink(string sectionName, Size size) => throw new NotImplementedException();
  33. public void DrawSection(string sectionName) => throw new NotImplementedException();
  34. }
  35. }