- Docs: Word-style dark page, phased fast open for long documents, fonts embedded in the DOCX, spellcheck toggle, hyperlink editing, and ~80 Word fidelity fixes (CJK/JP metrics, header/footer, tables, anchored pictures) - Sheets: hold formula recalculation while file data streams in, large-workbook scroll/load performance, combo charts, duplicate/unique conditional formatting by display text, RTL frozen-pane fix, workbooks whose ZIP entries carry a leading slash - Slides: MTX-compressed embedded font support, CJK/Latin face selection and PowerPoint script fallbacks, theme colors kept on paragraph defaults and bullets, more reliable AI edits with a layout audit after each batch - PDF: AI page ops, text block move/align, notes and markup editing, watermark and header/footer, form check boxes, metadata; the cloud Export as Word fallback is removed, conversion is always on-device - AI: Gemini tool schema translation, OpenCode Zen/Go providers, markdown tables and code blocks in chat, current date in the system prompt - Shell: Office-style ribbon collapse across all editors, native Windows ARM64 installer, BUILD_DIR override for packaging Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import type { TextboxDisplay } from '@genoffice/docx-engine'
|
|
import { textboxBandBottom, textboxBandTop } from '../src/renderer/editor/extensions'
|
|
|
|
describe('wrapTopAndBottom band vs live box height', () => {
|
|
const box: TextboxDisplay = { paras: [], bandTopPx: 20, bandBottomPx: 70, heightPx: 50 }
|
|
|
|
it('matches the parse-time bottom at the parse-time height', () => {
|
|
expect(textboxBandBottom(box)).toBe(70)
|
|
})
|
|
|
|
it('follows a changed height (autogrow / committed heightPx)', () => {
|
|
expect(textboxBandBottom(box, 120)).toBe(140)
|
|
expect(textboxBandBottom({ ...box, heightPx: 120 })).toBe(140)
|
|
})
|
|
|
|
it('keeps the parse-time bottom for boxes without a known height', () => {
|
|
const autoFit: TextboxDisplay = { paras: [], bandBottomPx: 90 }
|
|
expect(textboxBandBottom(autoFit)).toBe(90)
|
|
expect(textboxBandBottom(autoFit, undefined)).toBe(90)
|
|
})
|
|
|
|
it('sizes the band of a quarter-turned photo by its swapped extent', () => {
|
|
const turned = { paras: [], bandTopPx: 118, widthPx: 365, heightPx: 274, rotDeg: 90 }
|
|
// turned about its centre: 45.5px above and below the 274px layout box
|
|
expect(textboxBandBottom(turned)).toBeCloseTo(118 + 274 + 45.5, 5)
|
|
expect(textboxBandTop(turned)).toBeCloseTo(118 - 45.5, 5)
|
|
// autogrow re-derives both edges from the live height
|
|
expect(textboxBandTop(turned, 300)).toBeCloseTo(118 - 32.5, 5)
|
|
expect(textboxBandBottom(turned, 300)).toBeCloseTo(118 + 300 + 32.5, 5)
|
|
expect(textboxBandBottom({ ...turned, rotDeg: 180 })).toBe(118 + 274)
|
|
})
|
|
})
|