test(engine): stabilize full engine smoke

This commit is contained in:
Danila Poyarkov 2026-05-16 13:27:46 +03:00
parent 21b649e540
commit ab700fd8be
3 changed files with 4 additions and 24 deletions

View file

@ -14,7 +14,7 @@ import { heavy } from '#tests/helpers/test-utils'
setDefaultTimeout(30_000)
const FIXTURES = resolve(import.meta.dir, '../fixtures')
const FIXTURES = resolve(import.meta.dir, '../../../../fixtures')
describe('fig export compression', () => {
test('compressFigDataSync produces valid zip', async () => {

View file

@ -26,7 +26,7 @@ describe('Fix 4: text lineHeight serialization', () => {
expect(changes[0].lineHeight).toEqual({ value: 24, units: 'PIXELS' })
})
test('text node without lineHeight defaults to ceil(fontSize * 1.2)', () => {
test('text node without lineHeight omits lineHeight', () => {
const graph = new SceneGraph()
const node = graph.createNode('TEXT', pageId(graph), {
name: 'DefaultLH',
@ -38,31 +38,10 @@ describe('Fix 4: text lineHeight serialization', () => {
fontFamily: 'Inter',
fontWeight: 400,
fontSize: 16
// lineHeight not set — defaults to null
})
const changes = toKiwi(node, graph) as Record<string, unknown>[]
// ceil(16 * 1.2) = ceil(19.2) = 20
expect(changes[0].lineHeight).toEqual({ value: 20, units: 'PIXELS' })
})
test('lineHeight default for odd fontSize', () => {
const graph = new SceneGraph()
const node = graph.createNode('TEXT', pageId(graph), {
name: 'OddSize',
x: 0,
y: 0,
width: 100,
height: 20,
text: 'Hello',
fontFamily: 'Inter',
fontWeight: 400,
fontSize: 14
})
const changes = toKiwi(node, graph) as Record<string, unknown>[]
// ceil(14 * 1.2) = ceil(16.8) = 17
expect(changes[0].lineHeight).toEqual({ value: 17, units: 'PIXELS' })
expect(changes[0].lineHeight).toBeUndefined()
})
test('lineHeight survives roundtrip through export/parse', async () => {

View file

@ -76,6 +76,7 @@ describe('text measurement', () => {
// an older layout implementation. Post-layout, left-aligned HUG content retains x=8.
expect(visibleToolbar.x).toBe(8)
setTextMeasurer(null)
computeAllLayouts(graph, graph.getPages()[0].id)
expect(graph.getNode(visibleToolbar.id)?.x).toBe(8)