chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { convertToPng } from "../src/utils/image-convert.ts";
|
||||
import { convertToPng, loadPngTranscoder } from "../src/utils/image-convert.ts";
|
||||
import { formatDimensionNote, resizeImage } from "../src/utils/image-resize.ts";
|
||||
|
||||
// Small 2x2 red PNG image (base64) - generated with ImageMagick
|
||||
@@ -82,6 +82,14 @@ describe("convertToPng", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Issue #10292: pi-tui uses this transcoder to show non-PNG images on Kitty-protocol terminals.
|
||||
it("loadPngTranscoder converts synchronously to oriented PNG data", async () => {
|
||||
const transcoder = (await loadPngTranscoder())!;
|
||||
const png = Buffer.from(transcoder(jpegWithXmpBeforeOrientation(), "image/jpeg")!, "base64");
|
||||
expect([png.readUInt32BE(16), png.readUInt32BE(20)]).toEqual([1, 2]);
|
||||
expect(transcoder(Buffer.from("not an image").toString("base64"), "image/jpeg")).toBeNull();
|
||||
});
|
||||
|
||||
describe("resizeImage", () => {
|
||||
it("should keep caller input bytes intact", async () => {
|
||||
const input = new Uint8Array(imageBytes(TINY_PNG));
|
||||
|
||||
Reference in New Issue
Block a user