openpencil/tests/engine/render/canvas/text-font-variations.test.ts
2026-05-23 00:18:33 +03:00

23 lines
632 B
TypeScript

import { describe, expect, test } from 'bun:test'
import { textFontVariations } from '#core/canvas/text'
describe('canvas text font variations', () => {
test('passes imported variable font axes to CanvasKit text styles', () => {
expect(
textFontVariations([
{ axis: 'wght', value: 650 },
{ axis: 'wdth', value: 88 }
])
).toEqual([
{ axis: 'wght', value: 650 },
{ axis: 'wdth', value: 88 }
])
})
test('omits font variations when no axes are set', () => {
expect(textFontVariations([])).toBeUndefined()
expect(textFontVariations(undefined)).toBeUndefined()
})
})