(...args: string[])
| 69 | |
| 70 | /* Build a test image from a list of strings */ |
| 71 | export 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 | |
| 99 | const sup = "⁰¹²³⁴⁵⁶⁷⁸⁹ᵃᵇᶜᵈᵉᶠ"; |
| 100 |
no test coverage detected
searching dependent graphs…