MockCanvas.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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, string> DrawRectFunc { get; set; }
  15. public void Save() => throw new NotImplementedException();
  16. public void Restore() => throw new NotImplementedException();
  17. public void Translate(Position vector) => TranslateFunc(vector);
  18. public void Rotate(float angle) => RotateFunc(angle);
  19. public void Scale(float scaleX, float scaleY) => ScaleFunc(scaleX, scaleY);
  20. public void DrawFilledRectangle(Position vector, Size size, string color) => DrawRectFunc(vector, size, color);
  21. public void DrawStrokeRectangle(Position vector, Size size, float strokeWidth, string color) => throw new NotImplementedException();
  22. public void DrawParagraph(SkParagraph paragraph) => throw new NotImplementedException();
  23. public void DrawImage(SkImage image, Size size) => DrawImageFunc(image, Position.Zero, size);
  24. public void DrawPicture(SkPicture picture) => throw new NotImplementedException();
  25. public void DrawSvgPath(string path, uint color) => throw new NotImplementedException();
  26. public void DrawSvg(SkSvgImage svgImage, Size size) => throw new NotImplementedException();
  27. public void DrawOverflowArea(SkRect area) => throw new NotImplementedException();
  28. public void ClipOverflowArea(SkRect availableSpace, SkRect requiredSpace) => throw new NotImplementedException();
  29. public void ClipRectangle(SkRect clipArea) => throw new NotImplementedException();
  30. public void DrawHyperlink(string url, Size size) => throw new NotImplementedException();
  31. public void DrawSectionLink(string sectionName, Size size) => throw new NotImplementedException();
  32. public void DrawSection(string sectionName) => throw new NotImplementedException();
  33. }
  34. }