Documentation ¶
Overview ¶
Package testutils provides test methods that are not intended to be exported.
Index ¶
- Variables
- func CompareDictionariesDeep(d1, d2 *core.PdfObjectDictionary) bool
- func CompareImages(img1, img2 image.Image) (bool, error)
- func ComparePNGFiles(file1, file2 string) (bool, error)
- func CopyFile(src, dst string) error
- func HashFile(file string) (string, error)
- func ParseIndirectObjects(rawpdf string) (map[int64]core.PdfObject, error)
- func ReadPNG(file string) (image.Image, error)
- func RenderPDFToPNGs(pdfPath string, dpi int, outpathTpl string) error
- func RunRenderTest(t *testing.T, pdfPath, outputDir, baselineRenderPath string, saveBaseline bool)
Constants ¶
This section is empty.
Variables ¶
var (
ErrRenderNotSupported = errors.New("rendering PDF files is not supported on this system")
)
Errors.
Functions ¶
func CompareDictionariesDeep ¶
func CompareDictionariesDeep(d1, d2 *core.PdfObjectDictionary) bool
CompareDictionariesDeep does a deep comparison of `d1` and `d2` and returns true if equal.
func CompareImages ¶
CompareImages compares the specified images at pixel level.
func ComparePNGFiles ¶
ComparePNGFiles compares the specified PNG files.
func ParseIndirectObjects ¶
ParseIndirectObjects parses a sequence of indirect/stream objects sequentially from a `rawpdf` text. Great for testing.
func RenderPDFToPNGs ¶
RenderPDFToPNGs uses ghostscript (gs) to render the specified PDF file into a set of PNG images (one per page). PNG images will be named xxx-N.png where N is the number of page, starting from 1.
func RunRenderTest ¶
RunRenderTest renders the PDF file specified by `pdfPath` to the `outputDir` and compares the output PNG files to the golden files found at the `baselineRenderPath` location. If the specified PDF file is new (there are no golden files) and the `saveBaseline` parameter is set to true, the output render files are saved to the `baselineRenderPath`.
Types ¶
This section is empty.