1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-06 02:39:55 +02:00

PngParser: Add support for tIME chunk.

This commit is contained in:
Jeff Schiller 2024-01-18 19:48:18 -08:00
parent 9f5b3a4882
commit 1869cd7bfa
3 changed files with 65 additions and 3 deletions

View file

@ -10,6 +10,7 @@ import { PngColorType, PngInterlaceMethod, PngParser } from '../image/parsers/pn
/** @typedef {import('../image/parsers/png.js').PngImageGamma} PngImageGamma */
/** @typedef {import('../image/parsers/png.js').PngImageHeader} PngImageHeader */
/** @typedef {import('../image/parsers/png.js').PngIntlTextualData} PngIntlTextualData */
/** @typedef {import('../image/parsers/png.js').PngLastModTime} PngLastModTime */
/** @typedef {import('../image/parsers/png.js').PngPalette} PngPalette */
/** @typedef {import('../image/parsers/png.js').PngSignificantBits} PngSignificantBits */
/** @typedef {import('../image/parsers/png.js').PngTextualData} PngTextualData */
@ -233,4 +234,18 @@ describe('bitjs.image.parsers.PngParser', () => {
expect(bc.paletteIndex).equals(245);
});
});
it('extracts tIME', async () => {
/** @type {PngLastModTime} */
let lastModTime;
await getPngParser('tests/image-testfiles/cm9n0g04.png')
.onLastModTime(evt => { lastModTime = evt.lastModTime })
.start();
expect(lastModTime.year).equals(1999);
expect(lastModTime.month).equals(12);
expect(lastModTime.day).equals(31);
expect(lastModTime.hour).equals(23);
expect(lastModTime.minute).equals(59);
expect(lastModTime.second).equals(59);
});
});