testutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities for the Aseprite MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestConfigWithPath

func CreateTestConfigWithPath(t *testing.T, asepritePath string) *config.Config

CreateTestConfigWithPath creates a test config with explicit Aseprite path. Use this when you need to override the default config for specific tests.

func DecodeImage

func DecodeImage(r io.Reader) (image.Image, string, error)

DecodeImage decodes an image from a reader and returns the image and format.

func FormatPixelPos

func FormatPixelPos(x, y int) string

FormatPixelPos formats a pixel position as a string for use as a map key.

func LoadTestConfig

func LoadTestConfig(t *testing.T) *config.Config

LoadTestConfig loads the test configuration from the standard config file. Tests MUST have a valid config file with real Aseprite path configured.

func LoadTestConfigTB

func LoadTestConfigTB(tb TB) *config.Config

LoadTestConfigTB loads the test configuration for tests or benchmarks.

func TempSpriteDir

func TempSpriteDir(t *testing.T) string

TempSpriteDir returns a temporary directory for sprite files.

func TempSpritePath

func TempSpritePath(t *testing.T, name string) string

TempSpritePath returns a path for a temporary sprite file.

func TempSpritePathTB

func TempSpritePathTB(tb TB, filename string) string

TempSpritePath generates a temporary sprite file path for tests/benchmarks.

Types

type PixelData

type PixelData struct {
	X     int    `json:"x"`
	Y     int    `json:"y"`
	Color string `json:"color"`
}

PixelData represents a pixel with coordinates and color for testing.

func ParsePixelData

func ParsePixelData(jsonData string) ([]PixelData, error)

ParsePixelData parses JSON pixel data returned by get_pixels.

type TB

type TB interface {
	Helper()
	Fatalf(format string, args ...interface{})
	TempDir() string
}

TB is the interface common to *testing.T and *testing.B.

Jump to

Keyboard shortcuts

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