MockCanvas.cs 2.8 KB

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