- 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>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest'
|
|
import { clearPrintZoom, printZoom, setPrintZoom } from '../src/renderer/print-zoom'
|
|
|
|
const setDpr = (dpr: number) =>
|
|
Object.defineProperty(window, 'devicePixelRatio', { value: dpr, configurable: true })
|
|
|
|
describe('printZoom', () => {
|
|
it('reproduces the screen device scale and is a no-op at 1', () => {
|
|
expect(printZoom(1)).toBe(1)
|
|
expect(printZoom(2)).toBe(2)
|
|
expect(printZoom(1.5)).toBe(1.5)
|
|
})
|
|
|
|
it('clamps to the range Chromium print scales can invert', () => {
|
|
expect(printZoom(20)).toBe(10)
|
|
expect(printZoom(0.25)).toBe(0.5)
|
|
expect(printZoom(NaN)).toBe(1)
|
|
})
|
|
})
|
|
|
|
describe('setPrintZoom', () => {
|
|
afterEach(() => {
|
|
document.body.innerHTML = ''
|
|
setDpr(1)
|
|
})
|
|
|
|
it('zooms the preview root by the device scale and returns the inverse print scale', () => {
|
|
document.body.innerHTML = '<div class="pagination-preview"></div>'
|
|
setDpr(2)
|
|
expect(setPrintZoom()).toBe(0.5)
|
|
const root = document.querySelector<HTMLElement>('.pagination-preview')!
|
|
expect(root.style.getPropertyValue('--pv-print-zoom')).toBe('2')
|
|
clearPrintZoom()
|
|
expect(root.style.getPropertyValue('--pv-print-zoom')).toBe('')
|
|
})
|
|
|
|
it('leaves the preview untouched on standard-density screens', () => {
|
|
document.body.innerHTML = '<div class="pagination-preview"></div>'
|
|
setDpr(1)
|
|
expect(setPrintZoom()).toBe(1)
|
|
expect(
|
|
document
|
|
.querySelector<HTMLElement>('.pagination-preview')!
|
|
.style.getPropertyValue('--pv-print-zoom'),
|
|
).toBe('')
|
|
})
|
|
})
|