Files
genoffice/apps/docs/tests/tab-segment-width.test.ts
T
merrick-2002andGenOffice 69b4ce0560 Sync snapshot (2026-09-06) (#243)
- 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>
2026-09-07 00:18:14 +08:00

20 lines
912 B
TypeScript

import { describe, expect, it } from 'vitest'
import { tabSegmentWidth } from '../src/renderer/editor/decoration-extensions'
const line = (left: number, top: number) => ({ left, top, bottom: top + 20 })
describe('tabSegmentWidth', () => {
it('measures a segment that stays on the tab line', () => {
expect(tabSegmentWidth(line(100, 0), line(340, 0), 600, 1)).toBe(240)
expect(tabSegmentWidth(line(100, 0), line(340, 0), 600, 2)).toBe(120)
expect(tabSegmentWidth(line(100, 0), line(80, 5), 600, 1)).toBe(0)
})
// a wrapped segment is at least the column wide; measuring its endpoints
// pinned a claim's tab to a space width when the last line ended flush right
it('treats a segment ending on a later line as column-wide', () => {
expect(tabSegmentWidth(line(100, 0), line(620, 28), 600, 1)).toBe(600)
expect(tabSegmentWidth(line(100, 0), line(90, 56), 600, 1)).toBe(600)
})
})