Files
genoffice/apps/docs/tests/shape-gallery.test.ts
T
merrick-2002andGenOffice b3cab39441 Sync snapshot (2026-08-07) (#48)
- New AI Markdown app - the fifth suite app, with local image assets and ribbon AI entry points
- Shell: dark/light/system theme (imports public PR #41) with lint fix and dark-mode onboarding polish
- Docs: Word rendering fidelity fixes, 4x faster repagination, Shape Format contextual tab, auto-refreshing TOC page numbers
- Slides: built-in standard layouts, anchored zoom and jump-free editing, selectable Draw pen thickness
- Sheets: Insert Equation/Checkbox/Timeline, editing polish with undo for manual inserts and localized save errors
- Bump pdfjs-dist to 6.2.108 and js-yaml to 4.3.1

Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
2026-08-07 14:44:01 +08:00

33 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { SHAPE_GALLERY_GROUPS } from '../../../packages/ui/src/shape-gallery'
import { shapeBackgroundCss, shapePreviewPathD } from '../src/renderer/editor/shape-svg'
// The docs gallery (ribbon-tabs' DOC_SHAPE_GROUPS) is the full shared set, Lines included
const galleryPrsts = SHAPE_GALLERY_GROUPS.flatMap((group) =>
group.shapes.map((shape) => shape.prst),
)
describe('shape gallery', () => {
it('every gallery prst has preview and background geometry', () => {
const missing = galleryPrsts.filter(
(prst) =>
!shapePreviewPathD(prst, 20, 20) || !shapeBackgroundCss(prst, 189, 113, '4472C4', '2F5496'),
)
expect(missing).toEqual([])
})
it('has no duplicate prsts', () => {
expect(new Set(galleryPrsts).size).toBe(galleryPrsts.length)
})
it('background css is a data-uri svg with fill and stroke', () => {
const css = shapeBackgroundCss('heart', 189, 113, '4472C4', '2F5496')!
const encoded = /data:image\/svg\+xml,([^"]+)"/.exec(css)?.[1]
expect(encoded).toBeTruthy()
const svg = decodeURIComponent(encoded!)
expect(svg).toContain('#4472C4')
expect(svg).toContain('#2F5496')
})
})