Initial commit: Receipt Studio desktop application

This commit is contained in:
fuenmao
2026-10-19 11:09:09 +08:00
commit 2caac3c31f
77 changed files with 9846 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import {it,expect} from 'vitest'
import {withPngDensity} from '../src/main/png-density'
// A small valid PNG; injecting resolution must not change its image payload.
const source=Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jvF8AAAAASUVORK5CYII=','base64')
it('PNG 带有实际 300 DPI 分辨率且可重复更新',()=>{
const png=withPngDensity(source,300),index=png.indexOf('pHYs')
expect(png.readUInt32BE(index+4)).toBe(11811);expect(png.readUInt32BE(index+8)).toBe(11811)
const second=withPngDensity(png,150)
expect(second.toString('latin1').split('pHYs')).toHaveLength(2)
expect(second.readUInt32BE(second.indexOf('pHYs')+4)).toBe(5906)
})