The Export panel, SDK helpers, app menus, and CLI each kept their own hand-written format lists, so new formats such as PPTX reached some surfaces and not others. Scene Graph now owns the persisted export-setting format ids, Core IO adapters carry literal ids so that list is checked against real adapters, and the panel labels, scale handling, app format types, and CLI format validation/help are derived from the registry. PPTX joins the Export panel as a result.
20 lines
760 B
TypeScript
20 lines
760 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
|
|
import { BUILTIN_IO_FORMATS, IORegistry } from '@open-pencil/core/io'
|
|
import { EXPORT_FORMAT_IDS, isExportFormatId } from '@open-pencil/scene-graph'
|
|
|
|
const io = new IORegistry(BUILTIN_IO_FORMATS)
|
|
|
|
describe('export setting formats', () => {
|
|
test('every persisted export format is a node-exportable IO adapter', () => {
|
|
const nodeExportIds = new Set(io.listExportFormats('node').map((format) => format.id))
|
|
for (const id of EXPORT_FORMAT_IDS) expect(nodeExportIds.has(id)).toBe(true)
|
|
})
|
|
|
|
test('recognizes only persisted export formats', () => {
|
|
expect(isExportFormatId('pptx')).toBe(true)
|
|
expect(isExportFormatId('fig')).toBe(false)
|
|
expect(isExportFormatId('PNG')).toBe(false)
|
|
})
|
|
})
|