testutils

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRenderNotSupported = _adg.New("\u0072\u0065\u006e\u0064\u0065r\u0069\u006e\u0067\u0020\u0050\u0044\u0046\u0020\u0066\u0069\u006c\u0065\u0073 \u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u006f\u006e\u0020\u0074\u0068\u0069\u0073\u0020\u0073\u0079\u0073\u0074\u0065m")
	ErrImageSizeNotMatch  = _adg.New("\u0069\u006d\u0061ge\u0020\u0073\u0069\u007a\u0065\u0073\u0020\u0064\u006f\u006e\u0027\u0074\u0020\u006d\u0061\u0074\u0063\u0068")
)

Functions

func CombinePNGFiles

func CombinePNGFiles(file1, file2 string) (bool, error)

func CompareGoldenXML

func CompareGoldenXML(t *_cf.T, expectedFn string, got []byte)

func CompareGoldenZip

func CompareGoldenZip(t *_cf.T, expectedFn string, got []byte)

func CompareGoldenZipFilesOnly

func CompareGoldenZipFilesOnly(t *_cf.T, expectedFn string, got []byte)

func CompareImages

func CompareImages(img1, img2 _bb.Image) (bool, error)

func ComparePNGFiles

func ComparePNGFiles(file1, file2 string) (bool, error)

func CompareZip

func CompareZip(t *_cf.T, expectedFn string, got []byte, cmpFileContents bool)

func CopyFile

func CopyFile(src, dst string) error

func CreatePNGDiff

func CreatePNGDiff(src, dst string) (bool, string, float64, float64, error)

func HashFile

func HashFile(file string) (string, error)

func ReadPNG

func ReadPNG(file string) (_bb.Image, error)

func RenderPDFToPNGs

func RenderPDFToPNGs(pdfPath string, dpi int, outpathTpl string) error

func RunRenderOfficeTest

func RunRenderOfficeTest(t *_cf.T, pdfPath, outputDir, baselineRenderPath string, saveBaseline bool, currentHashMap *ReferenceMap, refFile *ReferenceFile, postfix string)

func RunRenderTest

func RunRenderTest(t *_cf.T, pdfPath, outputDir, baselineRenderPath string, saveBaseline bool, currentHashMap *ReferenceMap, refFile *ReferenceFile)

func ValidateDocument

func ValidateDocument(file string) (bool, error)

Types

type ReferenceEntry

type ReferenceEntry struct {
	Timestamp   int64   `json:"timestamp"`
	Value       string  `json:"value"`
	ResultSize  int64   `json:"resultSize,omitempty"`
	DiffPercent float64 `json:"diffPercent,omitempty"`
	DiffTotal   float64 `json:"diffValue,omitempty"`
	Invalid     bool    `json:"markedInvalid,omitempty"`
}

type ReferenceFile

type ReferenceFile struct {
	Timestamp _fd.Time      `json:"timestamp"`
	Map       *ReferenceMap `json:"map,omitempty"`
	// contains filtered or unexported fields
}

func ReadFile

func ReadFile(dirPath, testName string, createEmpty bool) (*ReferenceFile, error)

func (*ReferenceFile) Update

func (_dabc *ReferenceFile) Update(currentMap *ReferenceMap) error

type ReferenceMap

type ReferenceMap struct {
	_bc.Mutex
	// contains filtered or unexported fields
}

func (*ReferenceMap) Copy

func (_acd *ReferenceMap) Copy() *ReferenceMap

func (*ReferenceMap) Keys

func (_eb *ReferenceMap) Keys() (_dcb []string)

func (*ReferenceMap) Len

func (_def *ReferenceMap) Len() int

func (*ReferenceMap) MarshalJSON

func (_beg *ReferenceMap) MarshalJSON() ([]byte, error)

func (*ReferenceMap) Read

func (_fff *ReferenceMap) Read(key string) (ReferenceEntry, bool)

func (*ReferenceMap) UnmarshalJSON

func (_ebd *ReferenceMap) UnmarshalJSON(data []byte) error

func (*ReferenceMap) Write

func (_dgce *ReferenceMap) Write(key string, entry ReferenceEntry)

type ValidationResult

type ValidationResult struct {
	File   string `json:"file"`
	Result bool   `json:"result"`
	Note   string `json:"note"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL