Documentation
¶
Index ¶
- func ExtractPPTXImages(pptxContent []byte) ([][]byte, error)
- func ValidateGIF(gifBytes []byte, nFrames int, intervalMS int) error
- func ValidatePPTX(pptxContent, template []byte, nSlides int) error
- type GIFCompareOptions
- type GIFComparison
- type GIFInspection
- type PDFImage
- type PDFInspection
- type PDFPage
- type PagedImageComparison
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractPPTXImages ¶ added in v0.9.0
ExtractPPTXImages returns D2's embedded slide PNGs in slide order. It rejects gaps and duplicates instead of silently comparing whichever ZIP member was encountered first.
func ValidateGIF ¶
ValidateGIF checks the frame count, loop behavior, dimensions, and interval of gifBytes against D2's expected GIF output.
func ValidatePPTX ¶
ValidatePPTX checks that pptxContent contains the structure emitted by D2's PPTX exporter for nSlides.
Types ¶
type GIFCompareOptions ¶ added in v0.9.0
GIFCompareOptions controls exact display-pixel comparison. When RequireFrameChange is true, a constant animation is rejected even if the expected file is also accidentally constant.
type GIFComparison ¶ added in v0.9.0
type GIFComparison struct {
Expected, Actual *GIFInspection
FrameIndex int
FrameResult *imagediff.Result
}
GIFComparison contains the frame diagnostics available on a pixel mismatch. FrameResult can be written as a self-contained HTML report.
func CompareGIF ¶ added in v0.9.0
func CompareGIF(expectedBytes, actualBytes []byte, options GIFCompareOptions) (*GIFComparison, error)
CompareGIF compares playback metadata and exact composited frame pixels. Encoded palette layout and compression may differ without failing the test.
type GIFInspection ¶ added in v0.9.0
type GIFInspection struct {
Width, Height int
LoopCount int
Delays []int
TotalDurationCentiseconds int
FrameHashes [][sha256.Size]byte
ChangedFramePairs int
// contains filtered or unexported fields
}
GIFInspection is the decoded, display-equivalent GIF contract used by the raster E2E suite. FrameHashes are hashes of composited NRGBA pixels in playback order, not hashes of palette indices or encoded bytes.
func InspectGIF ¶ added in v0.9.0
func InspectGIF(gifBytes []byte) (*GIFInspection, error)
InspectGIF decodes and composites GIF frames according to their disposal methods. This catches palette-only, sub-rectangle, and frame-order changes that metadata-only validation misses.
type PDFInspection ¶ added in v0.9.0
type PDFInspection struct {
Pages []PDFPage
Images []PDFImage
ExternalLinks []string
InternalLinks int
}
PDFInspection is the bounded structural and raster view of PDFs emitted by D2's go-pdf/fpdf writer. It intentionally is not a general PDF parser.
func InspectD2PDF ¶ added in v0.9.0
func InspectD2PDF(content []byte) (*PDFInspection, error)
InspectD2PDF verifies page/link structure and decodes D2's embedded raster XObjects. Supported image streams are the exact FlateDecode + PNG predictor shape emitted by go-pdf/fpdf for D2's RGB/RGBA PNGs.
type PagedImageComparison ¶ added in v0.9.0
PagedImageComparison retains the first embedded-image mismatch so callers can write its self-contained HTML diagnostics.
func ComparePDFImages ¶ added in v0.9.0
func ComparePDFImages(pdfContent []byte, expectedPNGs [][]byte, options imagediff.Options) (*PagedImageComparison, error)
ComparePDFImages compares the decoded PDF XObject pixels with the supplied standalone format-equivalent PNGs.
func ComparePPTXImages ¶ added in v0.9.0
func ComparePPTXImages(pptxContent []byte, expectedPNGs [][]byte, options imagediff.Options) (*PagedImageComparison, error)
ComparePPTXImages compares each embedded slide PNG with the corresponding standalone format-equivalent PNG. Decoded dimensions and pixels are exact by default; encoded PNG metadata and compression are intentionally not.