/** * Canvas mock utilities for testing * * Provides mock implementations of Canvas 2D context * for testing chart and graphics code. * * @example * ```typescript * // Setup canvas mocks before tests * setupCanvasMocks(); * * // Now canvas operations won't throw * const canvas = document.createElement('canvas'); * const ctx = canvas.getContext('2d'); * ctx.fillRect(0, 0, 100, 100); // Works in jsdom * ``` */ /** * Mock Canvas 2D rendering context */ export interface MockCanvasContext { fillRect: () => void; clearRect: () => void; strokeRect: () => void; fillText: () => void; strokeText: () => void; measureText: (text: string) => { width: number; }; beginPath: () => void; closePath: () => void; moveTo: () => void; lineTo: () => void; arc: () => void; arcTo: () => void; bezierCurveTo: () => void; quadraticCurveTo: () => void; rect: () => void; fill: () => void; stroke: () => void; clip: () => void; save: () => void; restore: () => void; scale: () => void; rotate: () => void; translate: () => void; transform: () => void; setTransform: () => void; resetTransform: () => void; drawImage: () => void; createImageData: () => { data: Uint8ClampedArray; width: number; height: number; }; getImageData: () => { data: Uint8ClampedArray; width: number; height: number; }; putImageData: () => void; createLinearGradient: () => { addColorStop: () => void; }; createRadialGradient: () => { addColorStop: () => void; }; createPattern: () => null; isPointInPath: () => boolean; isPointInStroke: () => boolean; getLineDash: () => number[]; setLineDash: () => void; canvas: { width: number; height: number; }; fillStyle: string; strokeStyle: string; lineWidth: number; lineCap: string; lineJoin: string; miterLimit: number; lineDashOffset: number; font: string; textAlign: string; textBaseline: string; globalAlpha: number; globalCompositeOperation: string; shadowBlur: number; shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; imageSmoothingEnabled: boolean; } /** * Creates a mock Canvas 2D context * * @returns A mock context object */ export declare function createMockCanvasContext(): MockCanvasContext; /** * Sets up canvas mocks on HTMLCanvasElement prototype * * Call this in your test setup (beforeAll/beforeEach) to enable * canvas operations in jsdom environment. */ export declare function setupCanvasMocks(): void; //# sourceMappingURL=canvas.d.ts.map