Skip to content

The agent that grows with you

test(desktop): cover bicubic smoothing in pet sprite

fanfan343d474ba5615b0
diff --git a/apps/desktop/src/components/pet/pet-sprite.test.tsx b/apps/desktop/src/components/pet/pet-sprite.test.tsx
index 596a53f32e9..1adfc651407 100644
--- a/apps/desktop/src/components/pet/pet-sprite.test.tsx
+++ b/apps/desktop/src/components/pet/pet-sprite.test.tsx
@@ -246,7 +246,27 @@ describe('PetSprite RAF scheduling', () => {
render(<PetSprite info={INFO} pauseWhenUnfocused={false} />)
act(() => window.dispatchEvent(new Event('blur')))
-
expect(raf.pending()).toBe(1)
})
+
+ it('draws sprite frames with bicubic smoothing for illustration art', () => {
+ const raf = installRaf()
+ const ctxMock = {
+ clearRect: vi.fn(),
+ drawImage: vi.fn(),
+ imageSmoothingEnabled: false,
+ imageSmoothingQuality: 'low'
+ } as unknown as CanvasRenderingContext2D
+ vi.spyOn(HTMLCanvasElement.prototype, 'getContext').mockReturnValue(ctxMock)
+
+ render(<PetSprite info={INFO} />)
+ act(() => raf.runNext(0))
+
+ // Petdex sheets are illustration frames, not pixel art — nearest-neighbour
+ // (the old default) makes zoomed pets look blocky. The renderer must opt
+ // into bicubic smoothing before the first draw.
+ expect(ctxMock.imageSmoothingEnabled).toBe(true)
+ expect(ctxMock.imageSmoothingQuality).toBe('high')
+ expect(ctxMock.drawImage).toHaveBeenCalledTimes(1)
+ })
})