package imagetesting
import "github.com/gohugoio/hugo/resources/images/imagetesting"
Index ¶
- Variables
- func RunGolden(opts GoldenImageTestOpts) *hugolib.IntegrationTestBuilder
- type GoldenImageTestOpts
Variables ¶
var DefaultGoldenOpts = GoldenImageTestOpts{ WriteFiles: false, DevMode: false, }
To rebuild all Golden image tests, toggle WriteFiles=true and run: GOARCH=amd64 go test -count 1 -timeout 30s -run "^TestImagesGolden" ./... TODO(bep) see if we can do this via flags.
var SkipGoldenTests = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "s390x"
We don't have a CI test environment for these, and there are known dithering issues that makes these time consuming to maintain.
var UsesFMA = runtime.GOARCH == "s390x" || runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "arm64" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "loong64"
UsesFMA indicates whether "fused multiply and add" (FMA) instruction is used. The command "grep FMADD go/test/codegen/floats.go" can help keep the FMA-using architecture list updated.
Functions ¶
func RunGolden ¶
func RunGolden(opts GoldenImageTestOpts) *hugolib.IntegrationTestBuilder
Types ¶
type GoldenImageTestOpts ¶
type GoldenImageTestOpts struct {
// The test.
T testing.TB
// Name of the test. Will be used as the base folder for generated images.
// Slashes allowed and encouraged.
Name string
// The test site's files in txttar format.
Files string
// Set to true to write golden files to disk.
WriteFiles bool
// If not set, a temporary directory will be created.
WorkingDir string
// Set to true to print the temp dir used and keep it after the test.
PrintAndKeepTempDir bool
// Set to true to skip any assertions. Useful when adding new golden variants to a test.
DevMode bool
// Set to skip any assertions.
SkipAssertions bool
// Whether this represents a rebuild of the same site.
// Setting this to true will keep the previous golden image set.
Rebuild bool
}
GoldenImageTestOpts provides options for a golden image test.
Source Files ¶
- Version
- v0.153.4 (latest)
- Published
- Dec 28, 2025
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 4 months ago –
Tools for package owners.