Documentation
¶
Overview ¶
Package tests contains integration test helpers and fixture schemas shared between integration and fixture-generation tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SampleKey ¶
func SampleKey(level int, p SamplePosition) string
SampleKey formats a sampled-tile lookup key. The Reason isn't part of the key — it's metadata.
func SaveFixture ¶
SaveFixture writes f to fixturePath as indented JSON.
func TestdataDir ¶
func TestdataDir() string
TestdataDir returns the directory holding slide files for integration tests. Resolved from OPENTILE_TESTDIR env var; empty string means integration tests should t.Skip.
Types ¶
type AssociatedFixture ¶
type AssociatedFixture struct {
Type string `json:"kind"`
Size [2]int `json:"size"`
Compression string `json:"compression"`
SHA256 string `json:"sha256"`
}
AssociatedFixture is the per-associated-image portion of a fixture.
type Fixture ¶
type Fixture struct {
Slide string `json:"slide"`
Format string `json:"format"`
Levels []LevelFixture `json:"levels"`
Metadata MetadataFixture `json:"metadata"`
TileSHA256 map[string]string `json:"tiles,omitempty"`
SampledTileSHA256 map[string]SampledTile `json:"sampled_tiles,omitempty"`
ICCProfileSHA256 string `json:"icc_profile_sha256,omitempty"`
AssociatedImages []AssociatedFixture `json:"associated,omitempty"`
// Images is the multi-image view, populated for files where
// tiler.Images() returns more than one entry (multi-image OME).
// When populated, integration tests walk Images instead of the
// top-level Levels / TileSHA256 / SampledTileSHA256 fields. Each
// ImageFixture's per-tile hashes are namespaced by image index
// in the keys so OME images don't collide.
Images []ImageFixture `json:"images,omitempty"`
}
Fixture is the on-disk schema for a single-slide parity fixture.
The Levels / TileSHA256 / SampledTileSHA256 fields hold the single-image (or Images[0]) view; for multi-image formats (OME-TIFF) the Images field is populated with one entry per main pyramid and integration tests prefer it over the top-level Levels.
func LoadFixture ¶
LoadFixture reads a Fixture from fixturePath.
type ImageFixture ¶
type ImageFixture struct {
Index int `json:"index"`
Name string `json:"name,omitempty"`
Levels []LevelFixture `json:"levels"`
TileSHA256 map[string]string `json:"tiles,omitempty"`
SampledTileSHA256 map[string]SampledTile `json:"sampled_tiles,omitempty"`
}
ImageFixture is one main pyramid in a multi-image fixture. SampledTileSHA256 keys use the image index prefix to avoid collisions across images in the same fixture file.
type LevelFixture ¶
type MetadataFixture ¶
type MetadataFixture struct {
Magnification float64 `json:"magnification"`
ScannerManufacturer string `json:"scanner_manufacturer,omitempty"`
ScannerSerial string `json:"scanner_serial,omitempty"`
SoftwareLine string `json:"software_line,omitempty"`
MPP float64 `json:"mpp_um,omitempty"`
AcquisitionRFC3339 string `json:"acquisition_rfc3339,omitempty"`
}
type SamplePosition ¶
SamplePosition is one tile position chosen for a sampled fixture, paired with a label describing which code path it covers.
func SamplePositions ¶
func SamplePositions(grid opentile.Size, imageSize opentile.Size, tileSize opentile.Size) []SamplePosition
SamplePositions returns up to ~16 deliberately-chosen tile positions for a level: nine corner/diagonal/near-edge positions (Layer 1, position- based) plus circumstance-based positions (Layer 2) derived from the level's geometry. Duplicates collapse — bottom-right corner appears only once even though it's reached via both layers.
type SampledTile ¶
SampledTile is one entry in SampledTileSHA256: a hash paired with a human-readable label describing what code path the tile exercises.