MCPcopy
hub / github.com/jimp-dev/jimp / makeTestImage

Function makeTestImage

packages/test-utils/src/index.ts:71–97  ·  view source on GitHub ↗
(...args: string[])

Source from the content-addressed store, hash-verified

69
70/* Build a test image from a list of strings */
71export function makeTestImage(...args: string[]) {
72 const initialWidth = args[args.length - 1]?.length || 0;
73 const testImage: Bitmap = {
74 width: initialWidth,
75 height: args.length,
76 data: Buffer.alloc(initialWidth * args.length * 4),
77 };
78
79 for (let y = 0; y < testImage.height; y++) {
80 const line = args[y]!;
81 testImage.width = line.length;
82 const w = testImage.width;
83
84 for (let x = 0; x < w; x++) {
85 const char = line[x]!;
86 const color = colors[char];
87
88 if (typeof color === "undefined") {
89 throwUndefinedChar(char);
90 } else {
91 testImage.data.writeUInt32BE(color, 4 * (y * w + x));
92 }
93 }
94 }
95
96 return testImage;
97}
98
99const sup = "⁰¹²³⁴⁵⁶⁷⁸⁹ᵃᵇᶜᵈᵉᶠ";
100

Callers 15

index.test.tsFile · 0.90
scan.test.tsFile · 0.90
callbacks.test.tsFile · 0.90
crop.test.tsFile · 0.90
autocrop.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
normalize.test.tsFile · 0.90

Calls 1

throwUndefinedCharFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…